fix(psutil): sostituito p.connections() con p.net_connections() per compatibilità con versioni future
- Aggiornato system_monitor.py alla riga 587. - Implementata la logica di fallback per mantenere la retrocompatibilità (tenta prima net_connections, poi connections). - Risolto il DeprecationWarning relativo a psutil.
This commit is contained in:
+3
-2
@@ -583,8 +583,9 @@ def get_system_status():
|
||||
|
||||
for p in matching_procs:
|
||||
try:
|
||||
# Controlla i socket di rete del processo
|
||||
for conn in p.connections(kind='inet'):
|
||||
# Controlla i socket di rete del processo in modo retrocompatibile
|
||||
conn_func = getattr(p, "net_connections", p.connections)
|
||||
for conn in conn_func(kind='inet'):
|
||||
# Se c'è una connessione stabilita verso la porta del broker, è ok
|
||||
if conn.status == 'ESTABLISHED' and conn.raddr and conn.raddr.port == broker_port:
|
||||
is_mqtt_connected = True
|
||||
|
||||
Reference in New Issue
Block a user