MEDIUM: stream-int: use si_task() to retrieve the task from the stream int
We go back to the session to get the owner. Here again it's very easy
and is just a matter of relative offsets. Since the owner always exists
and always points to the session's task, we can remove some unneeded
tests.
diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h
index 4d5abcf..584abcf 100644
--- a/include/proto/stream_interface.h
+++ b/include/proto/stream_interface.h
@@ -73,6 +73,15 @@
return LIST_ELEM(si, struct session *, si[0]);
}
+/* returns the task associated to this stream interface */
+static inline struct task *si_task(struct stream_interface *si)
+{
+ if (si->flags & SI_FL_ISBACK)
+ return LIST_ELEM(si, struct session *, si[1])->task;
+ else
+ return LIST_ELEM(si, struct session *, si[0])->task;
+}
+
/* Initializes all required fields for a new appctx. Note that it does the
* minimum acceptable initialization for an appctx. This means only the
* 3 integer states st0, st1, st2 are zeroed.