mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-29 14:50:59 +01:00
MINOR: session: add a simple function to retrieve a session from a task
This function only casts t->context to (struct session *). It will avoid some ugly and unsafe casts in upcoming changes.
This commit is contained in:
parent
a94d2d7653
commit
787add2932
@ -50,6 +50,12 @@ int parse_track_counters(char **args, int *arg,
|
|||||||
struct track_ctr_prm *prm,
|
struct track_ctr_prm *prm,
|
||||||
struct proxy *defpx, char **err);
|
struct proxy *defpx, char **err);
|
||||||
|
|
||||||
|
/* returns the session from a void *owner */
|
||||||
|
static inline struct session *session_from_task(struct task *t)
|
||||||
|
{
|
||||||
|
return (struct session *)t->context;
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove the refcount from the session to the tracked counters, and clear the
|
/* Remove the refcount from the session to the tracked counters, and clear the
|
||||||
* pointer to ensure this is only performed once. The caller is responsible for
|
* pointer to ensure this is only performed once. The caller is responsible for
|
||||||
* ensuring that the pointer is valid first.
|
* ensuring that the pointer is valid first.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user