From: Mark Wooding Date: Wed, 2 Apr 2008 08:10:53 +0000 (+0100) Subject: blast: Fix segfault for immediate connection. X-Git-Tag: 1.3.5~2 X-Git-Url: https://git.distorted.org.uk/~mdw/fwd/commitdiff_plain/e35ff2b844e30196d4eb7c0693e5eaf214dfcbbb?hp=a9bd543ab4ebe415bca9d6f27b90f16ddac79bc0 blast: Fix segfault for immediate connection. This manifests itself when run under noip, which uses Unix-domain sockets instead. The problem is to do with the timer, which isn't active at the the that conn_init is called. --- diff --git a/blast.c b/blast.c index 597263e..60ef0f7 100644 --- a/blast.c +++ b/blast.c @@ -112,13 +112,14 @@ static void newconn(blast *b) goto fail; gettimeofday(&tv, 0); TV_ADD(&tv, &tv, &ctv); + sel_addtimer(&sel, &b->t, &tv, timeout, b); if (conn_init(&b->c, &sel, fd, (struct sockaddr *)&sin, sizeof(sin), connected, b)) goto fail; - sel_addtimer(&sel, &b->t, &tv, timeout, b); return; fail: + sel_rmtimer(&b->t); backoff(b); }