X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fprotocol_misc.c;h=8855d20e22a6ada4967c6bd8df759103173ccf2e;hb=ecfe7cbbe08dc99ba6f329ad66bb8ee09ce9539b;hp=5ec01d9253405e82849779905f02b66a42bf0ee0;hpb=f79cc0e0bba16a3aa42a5fa13098cda714623205;p=meshlink diff --git a/src/protocol_misc.c b/src/protocol_misc.c index 5ec01d92..8855d20e 100644 --- a/src/protocol_misc.c +++ b/src/protocol_misc.c @@ -72,7 +72,7 @@ bool send_ping(meshlink_handle_t *mesh, connection_t *c) { c->status.pinged = true; c->last_ping_time = mesh->loop.now.tv_sec; - return send_request(mesh, c, "%d", PING); + return send_request(mesh, c, NULL, "%d", PING); } bool ping_h(meshlink_handle_t *mesh, connection_t *c, const char *request) { @@ -81,7 +81,7 @@ bool ping_h(meshlink_handle_t *mesh, connection_t *c, const char *request) { } bool send_pong(meshlink_handle_t *mesh, connection_t *c) { - return send_request(mesh, c, "%d", PONG); + return send_request(mesh, c, NULL, "%d", PONG); } bool pong_h(meshlink_handle_t *mesh, connection_t *c, const char *request) { @@ -89,13 +89,16 @@ bool pong_h(meshlink_handle_t *mesh, connection_t *c, const char *request) { (void)request; c->status.pinged = false; - /* Succesful connection, reset timeout if this is an outgoing connection. */ + /* Successful connection, reset timeout if this is an outgoing connection. */ if(c->outgoing) { c->outgoing->timeout = 0; c->outgoing->cfg = NULL; - if(c->outgoing->ai) + + if(c->outgoing->ai) { freeaddrinfo(c->outgoing->ai); + } + c->outgoing->ai = NULL; c->outgoing->aip = NULL; }