diff --git a/src/stream_interface.c b/src/stream_interface.c index 05306cf5a..cbe6f6ea3 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -436,6 +436,7 @@ static void stream_int_notify(struct stream_interface *si) struct channel *ic = si_ic(si); struct channel *oc = si_oc(si); struct stream_interface *sio = si_opposite(si); + struct task *task = si_task(si); /* process consumer side */ if (channel_is_empty(oc)) { @@ -540,7 +541,14 @@ static void stream_int_notify(struct stream_interface *si) !(oc->flags & (CF_AUTO_CLOSE|CF_SHUTW_NOW|CF_SHUTW))) && (sio->state != SI_ST_EST || (channel_is_empty(oc) && !oc->to_forward)))))) { - task_wakeup(si_task(si), TASK_WOKEN_IO); + task_wakeup(task, TASK_WOKEN_IO); + } + else { + /* Update expiration date for the task and requeue it */ + task->expire = tick_first((tick_is_expired(task->expire, now_ms) ? 0 : task->expire), + tick_first(tick_first(ic->rex, ic->wex), + tick_first(oc->rex, oc->wex))); + task_queue(task); } if (ic->flags & CF_READ_ACTIVITY) ic->flags &= ~CF_READ_DONTWAIT;