MEDIUM: stream-int: make si_sess() use the stream int's side

This one relies on the SI's side to find the pointer to the session.
That the stream interface doesn't have to look at the task's context
anymore.
This commit is contained in:
Willy Tarreau 2014-11-28 12:03:32 +01:00
parent a2df3fa251
commit aefd79004c

View File

@ -64,6 +64,15 @@ static inline struct channel *si_oc(struct stream_interface *si)
return &LIST_ELEM(si, struct session *, si[0])->res;
}
/* returns the session associated to a stream interface */
static inline struct session *si_sess(struct stream_interface *si)
{
if (si->flags & SI_FL_ISBACK)
return LIST_ELEM(si, struct session *, si[1]);
else
return LIST_ELEM(si, struct session *, si[0]);
}
/* 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.
@ -365,12 +374,6 @@ static inline int si_connect(struct stream_interface *si)
return ret;
}
/* finds the session which owns a stream interface */
static inline struct session *si_sess(struct stream_interface *si)
{
return (struct session *)((struct task *)si->owner)->context;
}
/* for debugging, reports the stream interface state name */
static inline const char *si_state_str(int state)
{