39 lines
1.8 KiB
Diff
39 lines
1.8 KiB
Diff
|
|
From 732393fb7990fbb086976c8d7e33bb13e9aadedb Mon Sep 17 00:00:00 2001
|
||
|
|
From: PshySimon <caixiaomeng2@huawei.com>
|
||
|
|
Date: Tue, 18 Feb 2025 20:13:07 +0800
|
||
|
|
Subject: [PATCH] fix xalarm log not print and add on iter problem
|
||
|
|
|
||
|
|
---
|
||
|
|
src/services/xalarm/xalarm_transfer.py | 8 +++++---
|
||
|
|
1 file changed, 5 insertions(+), 3 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/src/services/xalarm/xalarm_transfer.py b/src/services/xalarm/xalarm_transfer.py
|
||
|
|
index 2ed5da4..ccf16f9 100644
|
||
|
|
--- a/src/services/xalarm/xalarm_transfer.py
|
||
|
|
+++ b/src/services/xalarm/xalarm_transfer.py
|
||
|
|
@@ -98,8 +98,9 @@ def wait_for_connection(server_sock, epoll, fd_to_socket, thread_should_stop):
|
||
|
|
logging.info(f"connection reach max num of {MAX_CONNECTION_NUM}, closed current connection!")
|
||
|
|
connection.close()
|
||
|
|
continue
|
||
|
|
- fd_to_socket[connection.fileno()] = connection
|
||
|
|
- logging.info("connection %d registered event.")
|
||
|
|
+ with LOCK:
|
||
|
|
+ fd_to_socket[connection.fileno()] = connection
|
||
|
|
+ logging.info("connection fd %d registered event.", connection.fileno())
|
||
|
|
except socket.error as e:
|
||
|
|
logging.debug(f"socket error, reason is {e}")
|
||
|
|
break
|
||
|
|
@@ -122,7 +123,8 @@ def transmit_alarm(server_sock, epoll, fd_to_socket, bin_data, alarm_str):
|
||
|
|
if connection is not server_sock:
|
||
|
|
try:
|
||
|
|
connection.sendall(bin_data)
|
||
|
|
- logging.info("Broadcast msg success, alarm msg is %s", alarm_str)
|
||
|
|
+ logging.info("Broadcast msg success, fd is %d, alarm msg is %s",
|
||
|
|
+ fileno, alarm_str)
|
||
|
|
except (BrokenPipeError, ConnectionResetError):
|
||
|
|
to_remove.append(fileno)
|
||
|
|
except Exception as e:
|
||
|
|
--
|
||
|
|
2.27.0
|
||
|
|
|