fix client timeout
as described by man(3) ev, to make it work with ev_timer_again().master
parent
21aa4a9315
commit
1e0b3880f9
|
@ -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. */
|
/* 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)
|
static void tip_client_start(struct tip_client *cli)
|
||||||
{
|
{
|
||||||
cli->state = TIP_CLIENT_RECEIVING_HEADER;
|
cli->state = TIP_CLIENT_RECEIVING_HEADER;
|
||||||
ev_io_start(tip_main_loop, &cli->io);
|
ev_io_start(tip_main_loop, &cli->io);
|
||||||
ev_timer_init(&cli->timer, tip_client_timer_cb, TIP_CLIENT_TIMEOUT, 0.);
|
ev_init(&cli->timer, tip_client_timer_cb);
|
||||||
ev_timer_start(tip_main_loop, &cli->timer);
|
cli->timer.repeat = TIP_CLIENT_TIMEOUT;
|
||||||
|
ev_timer_again(tip_main_loop, &cli->timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tip_client_pending(struct tip_client *cli)
|
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_set(&cli->io, tip_client_socket(cli), EV_READ | EV_WRITE);
|
||||||
ev_io_start(tip_main_loop, &cli->io);
|
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;
|
cli->state = TIP_CLIENT_PROCESSING_REQUEST_2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue