From: Willy Tarreau Date: Thu, 18 Jul 2019 13:09:57 +0000 (+0200) Subject: MINOR: stream: add a new target_addr entry in the stream structure X-Git-Tag: v2.1-dev2~296 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9042060b0b6e610d6770b082346e93a55f88e5f2;p=thirdparty%2Fhaproxy.git MINOR: stream: add a new target_addr entry in the stream structure The purpose will be to store the target address there and not to allocate a connection just for this anymore. For now it's only placed in the struct, a few fields were moved to plug some holes, and the entry is freed on release (never allocated yet for now). This must have no impact. Note that in order to fit, the store_count which previously was an int was turned into a short, which is way more than enough given that the hard-coded limit is 8. --- diff --git a/include/types/stream.h b/include/types/stream.h index c889345457..eb31f068bf 100644 --- a/include/types/stream.h +++ b/include/types/stream.h @@ -148,15 +148,16 @@ struct stream { struct freq_ctr call_rate; /* stream task call rate */ + short store_count; + enum obj_type obj_type; /* object type == OBJ_TYPE_STREAM */ + /* 1 unused bytes here */ + struct { struct stksess *ts; struct stktable *table; } store[8]; /* tracked stickiness values to store */ - int store_count; - - enum obj_type obj_type; /* object type == OBJ_TYPE_STREAM */ - /* 3 unused bytes here */ + struct sockaddr_storage *target_addr; /* the address to join if not null */ struct stkctr stkctr[MAX_SESS_STKCTR]; /* content-aware stick counters */ struct strm_flt strm_flt; /* current state of filters active on this stream */ diff --git a/src/stream.c b/src/stream.c index 0be1757251..80120d0ef1 100644 --- a/src/stream.c +++ b/src/stream.c @@ -270,6 +270,7 @@ struct stream *stream_new(struct session *sess, enum obj_type *origin) stream_init_srv_conn(s); s->target = sess->listener ? sess->listener->default_target : NULL; + s->target_addr = NULL; s->pend_pos = NULL; s->priority_class = 0; @@ -487,6 +488,7 @@ static void stream_free(struct stream *s) session_free(sess); } + sockaddr_free(&s->target_addr); pool_free(pool_head_stream, s); /* We may want to free the maximum amount of pools if the proxy is stopping */