From 1539a01645cc9c1d7b70dec559f5bafe6ca25012 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 11 May 2012 14:47:34 +0200 Subject: [PATCH] MINOR: stream_interface: add a client target : TARG_TYPE_CLIENT This one will be used to identify the direction the SI is being used. All incoming connections have a target of type TARG_TYPE_CLIENT. --- include/proto/stream_interface.h | 6 ++++++ include/types/stream_interface.h | 1 + src/peers.c | 2 +- src/session.c | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h index 212369620..cbe828257 100644 --- a/include/proto/stream_interface.h +++ b/include/proto/stream_interface.h @@ -56,6 +56,12 @@ static inline void clear_target(struct target *dest) dest->ptr.v = NULL; } +static inline void set_target_client(struct target *dest) +{ + dest->type = TARG_TYPE_CLIENT; + dest->ptr.v = NULL; +} + static inline void set_target_server(struct target *dest, struct server *s) { dest->type = TARG_TYPE_SERVER; diff --git a/include/types/stream_interface.h b/include/types/stream_interface.h index fb2b258e5..2c57acd31 100644 --- a/include/types/stream_interface.h +++ b/include/types/stream_interface.h @@ -80,6 +80,7 @@ enum { /* target types */ enum { TARG_TYPE_NONE = 0, /* no target set, pointer is NULL by definition */ + TARG_TYPE_CLIENT, /* target is a client, pointer is NULL by definition */ TARG_TYPE_PROXY, /* target is a proxy ; use address with the proxy's settings */ TARG_TYPE_SERVER, /* target is a server ; use address with server's and its proxy's settings */ TARG_TYPE_APPLET, /* target is an applet ; use only the applet */ diff --git a/src/peers.c b/src/peers.c index a3408f5a5..6d84b4e45 100644 --- a/src/peers.c +++ b/src/peers.c @@ -1157,7 +1157,7 @@ static struct session *peer_session_create(struct peer *peer, struct peer_sessio s->si[0].proto = NULL; s->si[0].release = NULL; s->si[0].send_proxy_ofs = 0; - clear_target(&s->si[0].target); + set_target_client(&s->si[0].target); s->si[0].exp = TICK_ETERNITY; s->si[0].flags = SI_FL_NONE; if (s->fe->options2 & PR_O2_INDEPSTR) diff --git a/src/session.c b/src/session.c index 302459928..77fc32e8e 100644 --- a/src/session.c +++ b/src/session.c @@ -173,7 +173,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr) s->si[0].proto = l->proto; s->si[0].release = NULL; s->si[0].send_proxy_ofs = 0; - clear_target(&s->si[0].target); + set_target_client(&s->si[0].target); s->si[0].exp = TICK_ETERNITY; s->si[0].flags = SI_FL_NONE;