We should never try to update a timer if it was never added to the event
loop. There were a few places that didn't have an explicit check to
prevent this from happening.
node_t *n = utcp_connection->utcp->priv;
meshlink_handle_t *mesh = n->mesh;
- if(n->mtuprobes == 31) {
+ if(n->mtuprobes == 31 && n->mtutimeout.cb) {
timeout_set(&mesh->loop, &n->mtutimeout, &(struct timespec) {
0, 0
});
}
/* Kick the ping timeout handler */
- timeout_set(&mesh->loop, &mesh->pingtimer, &(struct timespec) {
- 0, 0
- });
+ if(mesh->pingtimer.cb) {
+ timeout_set(&mesh->loop, &mesh->pingtimer, &(struct timespec) {
+ 0, 0
+ });
+ }
}
/*
new->request = xstrdup(request);
new->firstseen = mesh->loop.now.tv_sec;
- if(!mesh->past_request_tree->head) {
+ if(!mesh->past_request_tree->head && mesh->past_request_timeout.cb) {
timeout_set(&mesh->loop, &mesh->past_request_timeout, &(struct timespec) {
10, prng(mesh, TIMER_FUDGE)
});