summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core.c b/src/core.c
index 530c86a..0da582c 100644
--- a/src/core.c
+++ b/src/core.c
@@ -325,14 +325,15 @@ static void tip_client_timer_cb(struct ev_loop *loop, ev_timer *timer, int event
}
/* Shut down connection if there is no data after 15 seconds. */
-#define TIP_CLIENT_TIMEOUT 15
+#define TIP_CLIENT_TIMEOUT 15.
static void tip_client_start(struct tip_client *cli)
{
cli->state = TIP_CLIENT_RECEIVING_HEADER;
ev_io_start(tip_main_loop, &cli->io);
- ev_timer_init(&cli->timer, tip_client_timer_cb, TIP_CLIENT_TIMEOUT, 0.);
- ev_timer_start(tip_main_loop, &cli->timer);
+ ev_init(&cli->timer, tip_client_timer_cb);
+ cli->timer.repeat = TIP_CLIENT_TIMEOUT;
+ ev_timer_again(tip_main_loop, &cli->timer);
}
void tip_client_pending(struct tip_client *cli)
@@ -357,7 +358,7 @@ static void tip_client_activate_pending(void)
}
ev_io_set(&cli->io, tip_client_socket(cli), EV_READ | EV_WRITE);
ev_io_start(tip_main_loop, &cli->io);
- ev_timer_start(tip_main_loop, &cli->timer);
+ ev_timer_again(tip_main_loop, &cli->timer);
cli->state = TIP_CLIENT_PROCESSING_REQUEST_2;
break;
}