[MEDIUM] session: make it possible to call an I/O handler on both SI
This will be used when an I/O handler running in a stream interface
needs to establish a connection somewhere. We want the session
processor to evaluate both I/O handlers, depending on which side has
one. Doing so also requires that stream_int_update_embedded() wakes
the session up only when the other side is established or has closed,
for instance in order to handle connection errors without looping
indefinitely during the connection setup time.
The session processor still relies on BF_READ_ATTACHED being set,
though we must do whatever is required to remove this dependency.
diff --git a/src/session.c b/src/session.c
index 10c7f13..acd9770 100644
--- a/src/session.c
+++ b/src/session.c
@@ -1821,11 +1821,14 @@
s->req->rex = TICK_ETERNITY;
}
- /* Call the second stream interface's I/O handler if it's embedded.
+ /* Call the stream interfaces' I/O handlers when embedded.
* Note that this one may wake the task up again.
*/
- if (s->req->cons->iohandler) {
- s->req->cons->iohandler(s->req->cons);
+ if (s->req->cons->iohandler || s->rep->cons->iohandler) {
+ if (s->req->cons->iohandler)
+ s->req->cons->iohandler(s->req->cons);
+ if (s->rep->cons->iohandler)
+ s->rep->cons->iohandler(s->rep->cons);
if (task_in_rq(t)) {
/* If we woke up, we don't want to requeue the
* task to the wait queue, but rather requeue