@@ -2171,7 +2171,7 @@ def with_connection_from_address(function):
21712171 @functools .wraps (function )
21722172 def wrapper (device : Device , address : hci .Address , * args , ** kwargs ):
21732173 if connection := device .pending_connections .get (address ):
2174- return function (device , connection , address , * args , ** kwargs )
2174+ return function (device , connection , * args , ** kwargs )
21752175 for connection in device .connections .values ():
21762176 if connection .peer_address == address :
21772177 return function (device , connection , * args , ** kwargs )
@@ -6443,18 +6443,14 @@ def on_cs_procedure(self, event: hci.HCI_LE_CS_Procedure_Enable_Complete_Event):
64436443
64446444 # [Classic only]
64456445 @host_event_handler
6446- @try_with_connection_from_address
6446+ @with_connection_from_address
64476447 def on_role_change (
64486448 self ,
6449- connection : Optional [Connection ],
6450- peer_address : hci .Address ,
6449+ connection : Connection ,
64516450 new_role : hci .Role ,
64526451 ):
6453- if connection :
6454- connection .role = new_role
6455- connection .emit (connection .EVENT_ROLE_CHANGE , new_role )
6456- else :
6457- logger .warning ("Role change to unknown connection %s" , peer_address )
6452+ connection .role = new_role
6453+ connection .emit (connection .EVENT_ROLE_CHANGE , new_role )
64586454
64596455 # [Classic only]
64606456 @host_event_handler
0 commit comments