X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;ds=sidebyside;f=src%2Fprotocol.c;h=482808a7e71885c6cf37d24ce42444f9d18c8aac;hb=963c5055505f2fc117cd5efa06eaa02c9b2bf85d;hp=fa1dc13786b4a30cb02cfe079a2a06b37ecf8925;hpb=ea20fcfcded669ce8fbbda3a1f93f354ed254603;p=meshlink diff --git a/src/protocol.c b/src/protocol.c index fa1dc137..482808a7 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -129,7 +129,6 @@ void forward_request(meshlink_handle_t *mesh, connection_t *from, submesh_t *s, bool receive_request(meshlink_handle_t *mesh, connection_t *c, const char *request) { assert(request); - assert(*request); if(c->outgoing && mesh->proxytype == PROXY_HTTP && c->allow_request == ID) { if(!request[0] || request[0] == '\r') { @@ -208,7 +207,7 @@ static void age_past_requests(event_loop_t *loop, void *data) { } if(left) { - timeout_set(&mesh->loop, &mesh->past_request_timeout, &(struct timeval) { + timeout_set(&mesh->loop, &mesh->past_request_timeout, &(struct timespec) { 10, prng(mesh, TIMER_FUDGE) }); } @@ -229,7 +228,7 @@ bool seen_request(meshlink_handle_t *mesh, const char *request) { new->firstseen = mesh->loop.now.tv_sec; if(!mesh->past_request_tree->head) { - timeout_set(&mesh->loop, &mesh->past_request_timeout, &(struct timeval) { + timeout_set(&mesh->loop, &mesh->past_request_timeout, &(struct timespec) { 10, prng(mesh, TIMER_FUDGE) }); } @@ -243,7 +242,7 @@ void init_requests(meshlink_handle_t *mesh) { assert(!mesh->past_request_tree); mesh->past_request_tree = splay_alloc_tree((splay_compare_t) past_request_compare, (splay_action_t) free_past_request); - timeout_add(&mesh->loop, &mesh->past_request_timeout, age_past_requests, NULL, &(struct timeval) { + timeout_add(&mesh->loop, &mesh->past_request_timeout, age_past_requests, NULL, &(struct timespec) { 0, 0 }); }