opensnitch/daemon
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
..
conman added trace logs for packets and ebpf 2025-01-22 01:06:10 +01:00
core mount tracefs path if it's not mounted 2025-11-23 23:40:37 +01:00
data removed parameters from init services 2025-12-10 21:31:33 +01:00
dns ebpf dns improvements 2025-06-25 00:57:07 +02:00
firewall avoid crashing when executing fw tests 2025-12-03 22:33:15 +01:00
log tasks: send results to the loggers 2025-11-20 01:16:33 +01:00
netfilter structs fields reorganized 2024-01-14 20:44:49 +01:00
netlink netstat: dump AF_PACKET sockets from the kernel 2025-02-06 01:49:40 +01:00
netstat netstat: added option to monitor AF_PACKET sockets 2025-02-03 21:09:51 +01:00
procmon mount tracefs path if it's not mounted 2025-11-23 23:40:37 +01:00
rule fixed empty host name not being matched 2025-07-19 02:24:49 +05:00
statistics avoid to send empty stats to the GUI (server) 2025-12-11 12:07:10 +01:00
tasks tasks improvements 2025-11-28 00:02:52 +01:00
ui avoid to send empty stats to the GUI (server) 2025-12-11 12:07:10 +01:00
.gitignore daemon -> opensnitchd (ref #118) 2018-04-10 18:38:04 +02:00
go.mod Bumped cilium/ebpf version to 0.19.0 2025-07-07 23:06:19 +02:00
go.sum Bumped cilium/ebpf version to 0.19.0 2025-07-07 23:06:19 +02:00
Gopkg.toml fix: calling ftrace probe Reset in order to start from a clean state (fixes #159) 2018-04-18 02:00:12 +02:00
main.go Merge pull request #1418 from LordGrimmauld/audit-socket-path-config 2025-09-11 00:24:21 +02:00
Makefile init services moved to data/init/ 2025-11-24 00:07:07 +01:00