MINOR: Add TO/FROM_SET flags to struct stream_interface

[WT: it will make sense to remove SN_FRT_ADDR_SET and to use these
  flags everywhere instead ]
This commit is contained in:
Aman Gupta 2012-04-02 18:57:55 -07:00 committed by Willy Tarreau
parent 64559c565f
commit 0bc0c2426c
3 changed files with 4 additions and 0 deletions

View File

@ -73,6 +73,8 @@ enum {
SI_FL_INDEP_STR = 0x0040, /* independant streams = don't update rex on write */
SI_FL_NOLINGER = 0x0080, /* may close without lingering. One-shot. */
SI_FL_SRC_ADDR = 0x1000, /* get the source ip/port with getsockname */
SI_FL_TO_SET = 0x2000, /* addr.to is set */
SI_FL_FROM_SET = 0x4000, /* addr.from is set */
};
/* target types */

View File

@ -54,6 +54,7 @@ void get_frt_addr(struct session *s)
if (get_original_dst(s->si[0].fd, (struct sockaddr_in *)&s->si[0].addr.to, &namelen) == -1)
getsockname(s->si[0].fd, (struct sockaddr *)&s->si[0].addr.to, &namelen);
s->si[0].flags |= SI_FL_TO_SET;
s->flags |= SN_FRT_ADDR_SET;
}

View File

@ -443,6 +443,7 @@ int tcp_connect_server(struct stream_interface *si)
if (getsockname(fd, (struct sockaddr *)&si->addr.from, &addrlen) == -1) {
Warning("Cannot get source address for logging.\n");
}
si->flags |= SI_FL_FROM_SET;
}
fdtab[fd].owner = si;