MINOR: conn_stream: remove the now unused CS_FL_ADDR_*_SET flags

These flags indicate that the ->src or ->dst field in the conn_stream
is not null, which is something the caller already sees (and even tests
from the two sets of functions that set them). They maintain some burden
because an agent trying to set a source or destination has to manually
set the flags in addition to setting the pointer, so they provide no
value anymore, let's drop them.
This commit is contained in:
Willy Tarreau 2022-05-02 17:27:34 +02:00
parent 03bd3952a6
commit 04e9acaef4
3 changed files with 6 additions and 10 deletions

View File

@ -230,8 +230,6 @@ void show_cs_flags(unsigned int f)
SHOW_FLAG(f, CS_FL_DONT_WAKE);
SHOW_FLAG(f, CS_FL_NOLINGER);
SHOW_FLAG(f, CS_FL_NOHALF);
SHOW_FLAG(f, CS_FL_ADDR_FROM_SET);
SHOW_FLAG(f, CS_FL_ADDR_TO_SET);
SHOW_FLAG(f, CS_FL_ISBACK);
if (f) {

View File

@ -86,8 +86,8 @@ enum {
CS_FL_NONE = 0x00000000, /* Just for initialization purposes */
CS_FL_ISBACK = 0x00000001, /* Set for CS on back-side */
CS_FL_ADDR_FROM_SET = 0x00000002, /* source address is set */
CS_FL_ADDR_TO_SET = 0x00000004, /* destination address is set */
/* not used: 0x00000002 */
/* not used: 0x00000004 */
CS_FL_NOLINGER = 0x00000008, /* may close without lingering. One-shot. */
CS_FL_NOHALF = 0x00000010, /* no half close, close both sides at once */

View File

@ -171,7 +171,7 @@ static inline int cs_alloc_ibuf(struct conn_stream *cs, struct buffer_wait *wait
*/
static inline const struct sockaddr_storage *cs_src(struct conn_stream *cs)
{
if (cs->flags & CS_FL_ADDR_FROM_SET)
if (cs->src)
return cs->src;
if (!(cs->flags & CS_FL_ISBACK))
return sess_src(strm_sess(__cs_strm(cs)));
@ -191,7 +191,7 @@ static inline const struct sockaddr_storage *cs_src(struct conn_stream *cs)
*/
static inline const struct sockaddr_storage *cs_dst(struct conn_stream *cs)
{
if (cs->flags & CS_FL_ADDR_TO_SET)
if (cs->dst)
return cs->dst;
if (!(cs->flags & CS_FL_ISBACK))
return sess_dst(strm_sess(__cs_strm(cs)));
@ -214,7 +214,7 @@ static inline int cs_get_src(struct conn_stream *cs)
{
const struct sockaddr_storage *src = NULL;
if (cs->flags & CS_FL_ADDR_FROM_SET)
if (cs->src)
return 1;
if (!(cs->flags & CS_FL_ISBACK))
@ -231,7 +231,6 @@ static inline int cs_get_src(struct conn_stream *cs)
if (!sockaddr_alloc(&cs->src, src, sizeof(*src)))
return 0;
cs->flags |= CS_FL_ADDR_FROM_SET;
return 1;
}
@ -245,7 +244,7 @@ static inline int cs_get_dst(struct conn_stream *cs)
{
const struct sockaddr_storage *dst = NULL;
if (cs->flags & CS_FL_ADDR_TO_SET)
if (cs->dst)
return 1;
if (!(cs->flags & CS_FL_ISBACK))
@ -262,7 +261,6 @@ static inline int cs_get_dst(struct conn_stream *cs)
if (!sockaddr_alloc(&cs->dst, dst, sizeof(*dst)))
return 0;
cs->flags |= CS_FL_ADDR_TO_SET;
return 1;
}