only use __bytes__ when not argument is needed.

This commit is contained in:
Gilles Boccon-Gibod
2024-11-23 15:56:14 -08:00
parent b57096abe2
commit 9d3d5495ce
17 changed files with 62 additions and 115 deletions

View File

@@ -199,7 +199,7 @@ class Host(AbortableEventEmitter):
check_address_type: bool = False,
) -> Optional[Connection]:
for connection in self.connections.values():
if connection.peer_address.to_bytes() == bd_addr.to_bytes():
if bytes(connection.peer_address) == bytes(bd_addr):
if (
check_address_type
and connection.peer_address.address_type != bd_addr.address_type