diff --git a/bumble/gatt_client.py b/bumble/gatt_client.py index 76564245..23485df8 100644 --- a/bumble/gatt_client.py +++ b/bumble/gatt_client.py @@ -288,8 +288,6 @@ class Client: self._bearer_id = ( 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 else: bearer.on(bearer.EVENT_DISCONNECTION, self.on_disconnection) diff --git a/bumble/gatt_server.py b/bumble/gatt_server.py index 5ab94303..3fbbe2fd 100644 --- a/bumble/gatt_server.py +++ b/bumble/gatt_server.py @@ -115,7 +115,6 @@ class Server(utils.EventEmitter): channel.connection.handle, channel.source_cid, ) - channel.att_mtu = att.ATT_DEFAULT_MTU channel.sink = lambda pdu: self.on_gatt_pdu( channel, att.ATT_PDU.from_bytes(pdu) ) diff --git a/bumble/l2cap.py b/bumble/l2cap.py index 7023a870..f01276e9 100644 --- a/bumble/l2cap.py +++ b/bumble/l2cap.py @@ -1647,7 +1647,9 @@ class LeCreditBasedChannel(utils.EventEmitter): self.connection_result = None self.disconnection_result = None 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()