X-Git-Url: https://git.distorted.org.uk/~mdw/fwd/blobdiff_plain/73ac0c026980ee994ba80aa3dc05e94feff68fde..e35ff2b844e30196d4eb7c0693e5eaf214dfcbbb:/blast.c diff --git a/blast.c b/blast.c index 2791cb1..60ef0f7 100644 --- a/blast.c +++ b/blast.c @@ -103,7 +103,7 @@ static void timers(void) } puts(""); } - + static void newconn(blast *b) { int fd = socket(PF_INET, SOCK_STREAM, 0); @@ -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); } @@ -151,7 +152,7 @@ int main(int argc, char *argv[]) argv += optind; argc -= optind; if (argc != 2) { - pquis(stderr, "Usage: $ [-t time] [-n count] host port\n"); + pquis(stderr, "Usage: $ [-t TIME] [-n COUNT] HOST PORT\n"); exit(1); }