Changed ping_h - assume node is live when it pinged us

On larger networks with almost the same ping interval
nodes will ping each other at the same time, of course
it doesn't makes much traffic but the main reason why
we have PING/PONG is to check if other side is still
online. So, when we got PING from the other node then
it is alive.
This commit is contained in:
thorkill 2016-05-23 09:58:32 +02:00
parent 0bab833f76
commit 9c2170ed43

View file

@ -105,7 +105,9 @@ bool send_ping(connection_t *c) {
bool ping_h(connection_t *c, const char *request) {
int tv_sec, tv_usec, ret;
// Since we have got PING from them - the connection is alive
c->last_ping_time = now;
// Answer the ping
ret = sscanf(request, "%*d %d %d", &tv_sec, &tv_usec);
if (ret == 2) {
return send_pong_v2(c, tv_sec, tv_usec);