opensnitch/daemon/ui
Gustavo Iñiguez Goia 481dc1cd53
avoid to send empty stats to the GUI (server)
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.
2025-12-11 12:07:10 +01:00
..
auth more work on reloading configuration 2024-05-11 18:23:20 +02:00
config tasks: allow to load tasks from disk 2025-09-11 12:19:38 +02:00
protocol makefile: 2021-02-13 18:48:49 +03:00
testdata config tests: added missing comma 2025-09-11 00:29:02 +02:00
alerts.go fixed leak dispatching alerts 2023-12-31 20:12:44 +01:00
client.go avoid to send empty stats to the GUI (server) 2025-12-11 12:07:10 +01:00
client_test.go updated config tests 2025-06-19 23:49:45 +02:00
config_utils.go tasks: allow to load tasks from disk 2025-09-11 12:19:38 +02:00
notifications.go discard notification replies if channel is closed 2025-12-09 23:35:32 +01:00
notifications_tasks.go print the notifications type on error 2025-11-27 21:32:39 +01:00