[BUG] reset the stream_interface connect timeout upon connect or error
The stream_interface timeout was not reset upon a connect success or
error, leading to busy loops when requeuing tasks in the past.
Thanks to Bart Bobrowski for reporting the issue.
diff --git a/src/session.c b/src/session.c
index 9c06065..659dadb 100644
--- a/src/session.c
+++ b/src/session.c
@@ -182,6 +182,7 @@
* attempts and error reports.
*/
if (unlikely(si->flags & (SI_FL_EXP|SI_FL_ERR))) {
+ si->exp = TICK_ETERNITY;
si->state = SI_ST_CER;
fd_delete(si->fd);
@@ -219,6 +220,7 @@
* responsible for handling the transition from CON to EST.
*/
s->logs.t_connect = tv_ms_elapsed(&s->logs.tv_accept, &now);
+ si->exp = TICK_ETERNITY;
si->state = SI_ST_EST;
si->err_type = SI_ET_NONE;
si->err_loc = NULL;
@@ -1127,8 +1129,11 @@
t->expire = tick_first(t->expire, s->si[1].exp);
#ifdef DEBUG_FULL
- fprintf(stderr, "[%u] queuing with exp=%u req->rex=%u req->wex=%u req->ana_exp=%u rep->rex=%u rep->wex=%u, cs=%d, ss=%d\n",
- now_ms, t->expire, s->req->rex, s->req->wex, s->req->analyse_exp, s->rep->rex, s->rep->wex, s->si[0].state, s->si[1].state);
+ fprintf(stderr,
+ "[%u] queuing with exp=%u req->rex=%u req->wex=%u req->ana_exp=%u"
+ " rep->rex=%u rep->wex=%u, si[0].exp=%u, si[1].exp=%u, cs=%d, ss=%d\n",
+ now_ms, t->expire, s->req->rex, s->req->wex, s->req->analyse_exp,
+ s->rep->rex, s->rep->wex, s->si[0].exp, s->si[1].exp, s->si[0].state, s->si[1].state);
#endif
#ifdef DEBUG_DEV
diff --git a/src/stream_sock.c b/src/stream_sock.c
index 83c3c88..30d6b62 100644
--- a/src/stream_sock.c
+++ b/src/stream_sock.c
@@ -795,6 +795,7 @@
default:
si->ib->flags |= BF_SHUTR;
si->ib->rex = TICK_ETERNITY;
+ si->exp = TICK_ETERNITY;
return;
}
}
@@ -819,6 +820,7 @@
if (si->ob->flags & BF_SHUTW) {
fd_delete(si->fd);
si->state = SI_ST_DIS;
+ si->exp = TICK_ETERNITY;
return;
}
EV_FD_CLR(si->fd, DIR_RD);