Răsfoiți Sursa

Remove dangerous lock=None in connection close methods

Setting self.lock = None after close() caused race conditions:
- Motion thread calls readline() with "with self.lock:"
- If close() was called, lock is None
- AttributeError is caught, motion thread retries forever
- Pattern hangs waiting for "ok" that never comes

This was a regression not present in main branch.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
tuanchris 1 săptămână în urmă
părinte
comite
8707c4ed58
1 a modificat fișierele cu 1 adăugiri și 5 ștergeri
  1. 1 5
      modules/connection/connection_manager.py

+ 1 - 5
modules/connection/connection_manager.py

@@ -119,8 +119,6 @@ class SerialConnection(BaseConnection):
         with self.lock:
             if self.ser.is_open:
                 self.ser.close()
-        # Release the lock resources
-        self.lock = None
 
 ###############################################################################
 # WebSocket Connection Implementation
@@ -184,9 +182,7 @@ class WebSocketConnection(BaseConnection):
         with self.lock:
             if self.ws:
                 self.ws.close()
-        # Release the lock resources
-        self.lock = None
-                
+
 def list_serial_ports():
     """Return a list of available serial ports."""
     ports = serial.tools.list_ports.comports()