@@ -70,7 +70,7 @@ def on_open(self, task):
7070 return
7171
7272 LOGGER .info ('Connection to ROS ready.' )
73- self ._manual_disconnect = False
73+ self .factory . manual_disconnect = False
7474 self .factory .ready (self )
7575 self .factory .manager .call_in_thread (self .start_listening )
7676
@@ -174,7 +174,7 @@ def start_listening(self):
174174
175175 def send_close (self ):
176176 """Trigger the closure of the websocket indicating normal closing process."""
177- self ._manual_disconnect = True
177+ self .factory . manual_disconnect = True
178178
179179 err_desc = ''
180180 err_code = WebSocketCloseStatus .NormalClosure
@@ -273,6 +273,7 @@ class CliRosBridgeClientFactory(EventEmitterMixin):
273273 def __init__ (self , url , * args , ** kwargs ):
274274 super (CliRosBridgeClientFactory , self ).__init__ (* args , ** kwargs )
275275 self ._manager = CliEventLoopManager ()
276+ self .manual_disconnect = False
276277 self .proto = None
277278 self .url = url
278279 self .delay = self .initial_delay
@@ -313,16 +314,16 @@ def reset_delay(self):
313314 self .delay = self .initial_delay
314315
315316 def _reconnect_if_needed (self ):
316- if self .proto and self . proto . _manual_disconnect :
317+ if self .manual_disconnect :
317318 return
318319
319320 if self .max_retries is not None and (self .retries >= self .max_retries ):
320- LOGGER .info ('Abandonning after {} retries' .format (self .retries ))
321+ LOGGER .info ("Abandoning after {} retries" .format (self .retries ))
321322 return
322323
323324 self .retries += 1
324325 self .delay = min (self .delay * self .factor , self .max_delay )
325- LOGGER .info (' Connection manager will retry in {} seconds' .format (int (self .delay )))
326+ LOGGER .info (" Connection manager will retry in {} seconds" .format (int (self .delay )))
326327
327328 self .manager .call_later (self .delay , self .connect )
328329
0 commit comments