From: Willy Tarreau Date: Sat, 28 Mar 2009 09:47:26 +0000 (+0100) Subject: [BUG] reset the stream_interface connect timeout upon connect or error X-Git-Tag: v1.3.17~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=127334e89bb6b70631f3476769329394e7fa07c4;p=thirdparty%2Fhaproxy.git [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 9c06065f5b..659dadb5be 100644 --- a/src/session.c +++ b/src/session.c @@ -182,6 +182,7 @@ int sess_update_st_con_tcp(struct session *s, struct stream_interface *si) * 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 @@ int sess_update_st_con_tcp(struct session *s, struct stream_interface *si) * 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 @@ resync_stream_interface: 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 83c3c88409..30d6b62275 100644 --- a/src/stream_sock.c +++ b/src/stream_sock.c @@ -795,6 +795,7 @@ void stream_sock_shutw(struct stream_interface *si) default: si->ib->flags |= BF_SHUTR; si->ib->rex = TICK_ETERNITY; + si->exp = TICK_ETERNITY; return; } } @@ -819,6 +820,7 @@ void stream_sock_shutr(struct stream_interface *si) 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);