Skip to content

Feat: reconnect socket in case of failure in socket output #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jan 6, 2022
Merged
10 changes: 10 additions & 0 deletions src/sensor.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,16 @@ main(int argc, char **argv)
return ret;
}

/* Disable EPIPE signal: when writting to a closed socket we get an EPIPE signal,
which stops the sensor entirely. Insteas, we ignore this signal and deal manually
with the issue when wrting to the socket.
*/
signal(SIGPIPE, SIG_IGN);

// rand / srand are weak but given we only use them for jitter uin exponential backoff,
// their good enough for us.
srand(time(NULL)); // NOLINT(cert-msc32-c,cert-msc51-cpp)

/* disable limit of maximum czmq sockets */
zsys_set_max_sockets(0);

Expand Down
Loading