X-Git-Url: https://git.distorted.org.uk/~mdw/fwd/blobdiff_plain/9515272fc0a92f82c056a9b8bca0633822e14d9c..096c89c34505cadba1fc6e7a5367273d5c5bea47:/blast.c diff --git a/blast.c b/blast.c index d032646..cda5346 100644 --- a/blast.c +++ b/blast.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -34,7 +35,7 @@ static struct timeval ctv = { 0, 500000 }; static sel_timer sec; static unsigned count = 0; -static void timers(void); +static void IGNORABLE timers(void); static void stats(struct timeval *tv, void *p) { @@ -103,7 +104,7 @@ static void timers(void) } puts(""); } - + static void newconn(blast *b) { int fd = socket(PF_INET, SOCK_STREAM, 0); @@ -112,13 +113,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); }