Fix credential_db schema conflict and add resilience
credential_sniffer and credential_db both wrote to the same credentials.db with different schemas; credential_db's executescript failed when creating the crack_status index on an existing table that lacked that column. Fix: split credential_db's schema init into table DDL + migration + indexes so missing columns are added before index creation runs. Migration also handles any future schema drift. state.py: add 30s timeout + busy_timeout PRAGMA to write connection so concurrent subprocess writes stop failing with 'database is locked'. capture_bus.py: reconnect on ENETDOWN instead of aborting the capture loop — mac_manager temporarily brings the interface down during MAC rotation which was silently killing all packet capture.
This commit is contained in:
+15
-3
@@ -170,9 +170,21 @@ class CaptureBus:
|
||||
except socket.timeout:
|
||||
continue
|
||||
except OSError as e:
|
||||
if self._running:
|
||||
logger.error("Socket read error: %s", e)
|
||||
break
|
||||
if not self._running:
|
||||
break
|
||||
logger.warning("Socket read error: %s — reconnecting in 3s", e)
|
||||
try:
|
||||
self._sock.close()
|
||||
except Exception:
|
||||
pass
|
||||
time.sleep(3)
|
||||
try:
|
||||
self._sock = self._open_socket()
|
||||
logger.info("CaptureBus reconnected on %s", self.interface)
|
||||
except OSError as e2:
|
||||
logger.error("CaptureBus reconnect failed: %s", e2)
|
||||
time.sleep(10)
|
||||
continue
|
||||
|
||||
ts = time.time()
|
||||
self._total_packets += 1
|
||||
|
||||
Reference in New Issue
Block a user