X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;ds=sidebyside;f=ccan%2Fio%2Ftest%2Frun-15-timeout.c;h=64741c4f0c869907d3e212a67018732c8f0c3e40;hb=a7188fd690ee1370fa69dd33320770a24f33c071;hp=5709ddaa8a25416d6bb56c2a7d21ce81688e0e52;hpb=36bfb66bdf74f4f3382cd00dae7b899e80e2cf1a;p=ccan diff --git a/ccan/io/test/run-15-timeout.c b/ccan/io/test/run-15-timeout.c index 5709ddaa..64741c4f 100644 --- a/ccan/io/test/run-15-timeout.c +++ b/ccan/io/test/run-15-timeout.c @@ -8,11 +8,7 @@ #include #include -#ifdef DEBUG_CONN -#define PORT "64015" -#else #define PORT "65015" -#endif struct data { struct timers timers; @@ -38,17 +34,13 @@ static struct io_plan *no_timeout(struct io_conn *conn, struct data *d) static struct io_plan *init_conn(struct io_conn *conn, struct data *d) { -#ifdef DEBUG_CONN - io_set_debug(conn, true); -#endif ok1(d->state == 0); d->state++; d->conn = conn; io_set_finish(conn, finish_ok, d); - timer_add(&d->timers, &d->timer, - timeabs_add(time_now(), time_from_usec(d->timeout_usec))); + timer_addrel(&d->timers, &d->timer, time_from_usec(d->timeout_usec)); return io_read(conn, d->buf, sizeof(d->buf), no_timeout, d); } @@ -97,7 +89,7 @@ int main(void) plan_tests(21); d->state = 0; d->timeout_usec = 100000; - timers_init(&d->timers, time_now()); + timers_init(&d->timers, time_mono()); timer_init(&d->timer); fd = make_listen_fd(PORT, &addrinfo); ok1(fd >= 0); @@ -131,7 +123,7 @@ int main(void) /* One element, d->timer. */ ok1(expired == &d->timer); - ok1(!timers_expire(&d->timers, time_now())); + ok1(!timers_expire(&d->timers, time_mono())); ok1(d->state == 1); io_close(d->conn);