Merge pull request #863 from zxzxwu/eatt-mtu

Correct ATT_MTU in enhanced bearers
This commit is contained in:
zxzxwu
2026-01-16 15:08:12 +08:00
committed by GitHub
3 changed files with 3 additions and 4 deletions

View File

@@ -288,8 +288,6 @@ class Client:
self._bearer_id = ( self._bearer_id = (
f'[0x{bearer.connection.handle:04X}|CID=0x{bearer.source_cid:04X}]' f'[0x{bearer.connection.handle:04X}|CID=0x{bearer.source_cid:04X}]'
) )
# Fill the mtu.
bearer.on_att_mtu_update(att.ATT_DEFAULT_MTU)
self.connection = bearer.connection self.connection = bearer.connection
else: else:
bearer.on(bearer.EVENT_DISCONNECTION, self.on_disconnection) bearer.on(bearer.EVENT_DISCONNECTION, self.on_disconnection)

View File

@@ -115,7 +115,6 @@ class Server(utils.EventEmitter):
channel.connection.handle, channel.connection.handle,
channel.source_cid, channel.source_cid,
) )
channel.att_mtu = att.ATT_DEFAULT_MTU
channel.sink = lambda pdu: self.on_gatt_pdu( channel.sink = lambda pdu: self.on_gatt_pdu(
channel, att.ATT_PDU.from_bytes(pdu) channel, att.ATT_PDU.from_bytes(pdu)
) )

View File

@@ -1647,7 +1647,9 @@ class LeCreditBasedChannel(utils.EventEmitter):
self.connection_result = None self.connection_result = None
self.disconnection_result = None self.disconnection_result = None
self.drained = asyncio.Event() self.drained = asyncio.Event()
self.att_mtu = 0 # Filled by GATT client or server later. # Core Specification Vol 3, Part G, 5.3.1 ATT_MTU
# ATT_MTU shall be set to the minimum of the MTU field values of the two devices.
self.att_mtu = min(mtu, peer_mtu)
self.drained.set() self.drained.set()