[BUG] don't refresh timeouts late after detected activity

In old versions, before 1.3.16, we had to refresh the timeouts after
each call to process_session() because the stream socket handler did
not do it. Now that the sockets can exchange data for a long period
without calling process_session(), we can detect an old activity and
refresh a timeout long after the last activity, causing too late a
detection of some timeouts.

The fix simply consists in not checking for activity anymore in
stream_sock_data_finish() but only set a timeout if it was not
previously set.
This commit is contained in:
Willy Tarreau 2009-10-04 10:56:08 +02:00
parent 816fc22a4a
commit fe8903cc76

View File

@ -916,12 +916,12 @@ void stream_sock_data_finish(struct stream_interface *si)
else { else {
/* (re)start reading and update timeout. Note: we don't recompute the timeout /* (re)start reading and update timeout. Note: we don't recompute the timeout
* everytime we get here, otherwise it would risk never to expire. We only * everytime we get here, otherwise it would risk never to expire. We only
* update it if is was not yet set, or if we already got some read status. * update it if is was not yet set. The stream socket handler will already
* have updated it if there has been a completed I/O.
*/ */
si->flags &= ~SI_FL_WAIT_ROOM; si->flags &= ~SI_FL_WAIT_ROOM;
EV_FD_COND_S(fd, DIR_RD); EV_FD_COND_S(fd, DIR_RD);
if (!(ib->flags & BF_READ_NOEXP) && if (!(ib->flags & BF_READ_NOEXP) && !tick_isset(ib->rex))
(!tick_isset(ib->rex) || ib->flags & BF_READ_ACTIVITY))
ib->rex = tick_add_ifset(now_ms, ib->rto); ib->rex = tick_add_ifset(now_ms, ib->rto);
} }
} }
@ -939,11 +939,12 @@ void stream_sock_data_finish(struct stream_interface *si)
else { else {
/* (re)start writing and update timeout. Note: we don't recompute the timeout /* (re)start writing and update timeout. Note: we don't recompute the timeout
* everytime we get here, otherwise it would risk never to expire. We only * everytime we get here, otherwise it would risk never to expire. We only
* update it if is was not yet set, or if we already got some write status. * update it if is was not yet set. The stream socket handler will already
* have updated it if there has been a completed I/O.
*/ */
si->flags &= ~SI_FL_WAIT_DATA; si->flags &= ~SI_FL_WAIT_DATA;
EV_FD_COND_S(fd, DIR_WR); EV_FD_COND_S(fd, DIR_WR);
if (!tick_isset(ob->wex) || ob->flags & BF_WRITE_ACTIVITY) { if (!tick_isset(ob->wex)) {
ob->wex = tick_add_ifset(now_ms, ob->wto); ob->wex = tick_add_ifset(now_ms, ob->wto);
if (tick_isset(ib->rex) && !(si->flags & SI_FL_INDEP_STR)) { if (tick_isset(ib->rex) && !(si->flags & SI_FL_INDEP_STR)) {
/* Note: depending on the protocol, we don't know if we're waiting /* Note: depending on the protocol, we don't know if we're waiting