mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-15 10:06:55 +00:00
MINOR: stream_interface: add a pointer to the listener for TARG_TYPE_CLIENT
When the target is a client, it will be convenient to have a pointer to the original listener so that we can retrieve some configuration information at the stream interface level.
This commit is contained in:
parent
1348d4ce0b
commit
21adb02d19
@ -63,10 +63,10 @@ static inline void clear_target(struct target *dest)
|
||||
dest->ptr.v = NULL;
|
||||
}
|
||||
|
||||
static inline void set_target_client(struct target *dest)
|
||||
static inline void set_target_client(struct target *dest, struct listener *l)
|
||||
{
|
||||
dest->type = TARG_TYPE_CLIENT;
|
||||
dest->ptr.v = NULL;
|
||||
dest->ptr.l = l;
|
||||
}
|
||||
|
||||
static inline void set_target_server(struct target *dest, struct server *s)
|
||||
@ -111,6 +111,13 @@ static inline struct server *target_srv(struct target *t)
|
||||
return t->ptr.s;
|
||||
}
|
||||
|
||||
static inline struct listener *target_client(struct target *t)
|
||||
{
|
||||
if (!t || t->type != TARG_TYPE_CLIENT)
|
||||
return NULL;
|
||||
return t->ptr.l;
|
||||
}
|
||||
|
||||
static inline void stream_interface_prepare(struct stream_interface *si, const struct sock_ops *ops)
|
||||
{
|
||||
si->conn.data = ops;
|
||||
|
@ -122,6 +122,7 @@ struct target {
|
||||
struct server *s; /* when type is TARG_TYPE_SERVER */
|
||||
struct si_applet *a; /* when type is TARG_TYPE_APPLET */
|
||||
struct task *t; /* when type is TARG_TYPE_TASK */
|
||||
struct listener *l; /* when type is TARG_TYPE_CLIENT */
|
||||
} ptr;
|
||||
};
|
||||
|
||||
|
@ -1157,7 +1157,7 @@ static struct session *peer_session_create(struct peer *peer, struct peer_sessio
|
||||
s->si[0].conn.ctrl = NULL;
|
||||
s->si[0].release = NULL;
|
||||
s->si[0].send_proxy_ofs = 0;
|
||||
set_target_client(&s->si[0].target);
|
||||
set_target_client(&s->si[0].target, l);
|
||||
s->si[0].exp = TICK_ETERNITY;
|
||||
s->si[0].flags = SI_FL_NONE;
|
||||
if (s->fe->options2 & PR_O2_INDEPSTR)
|
||||
|
@ -169,7 +169,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
|
||||
s->si[0].conn.ctrl = l->proto;
|
||||
s->si[0].release = NULL;
|
||||
s->si[0].send_proxy_ofs = 0;
|
||||
set_target_client(&s->si[0].target);
|
||||
set_target_client(&s->si[0].target, l);
|
||||
s->si[0].exp = TICK_ETERNITY;
|
||||
s->si[0].flags = SI_FL_NONE;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user