mirror of
https://github.com/evilsocket/opensnitch.git
synced 2026-06-08 20:27:34 +00:00
By default, every second we send to the GUI the collected statistics by the daemon: metrics + events (connections). This call has a hard-coded timeout of one second, and if it reaches the deadline, a warning message is printed to the log. After several timeouts, the daemon closes the connection and tries to reconnect again. The daemon invokes this call even if there're no statistics to send. With one daemon and one GUI, it's not much of a problem. But if there're n nodes, the GUI will receive a minimum of n connections every second. In many scenarios, these empty calls are unnecessary. So, in order to optimize this behaviour, if the daemon has not collected new statistics, we won't invoke this call. This will slightly reduce the load on the GUI (server) when managing multiple nodes, and will save some CPU cycles on the daemon side. The connection status between the daemon and the GUI is managed with the following gRPC options: - The server and the daemon configures a 5-seconds keepalive to keep the channel open: 'grpc.keepalive_time_ms', 5000 - If after 5 seconds the keepalive msg is not received, then after 20 seconds the connection with the daemon will be closed if the server doesn't receive a response: 'grpc.keepalive_timeout_ms', 20000 So after about 30 seconds, if the daemon can't communicate with the GUI (server), it'll close the connection and retry it every second.