mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-24 21:52:17 +00:00
DEV: tcploop: make the current address the default address
It's difficult to refine bind/connect right now, let's make the address optionall by turning it to the default one.
This commit is contained in:
parent
98028c8d0a
commit
7184ca23c6
@ -732,7 +732,7 @@ int tcp_fork(int sock, const char *arg)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct sockaddr_storage ss;
|
||||
struct sockaddr_storage default_addr;
|
||||
struct err_msg err;
|
||||
const char *arg0;
|
||||
int loop_arg;
|
||||
@ -765,7 +765,7 @@ int main(int argc, char **argv)
|
||||
pid = getpid();
|
||||
signal(SIGCHLD, sig_handler);
|
||||
|
||||
if (addr_to_ss(argv[1], &ss, &err) < 0)
|
||||
if (addr_to_ss(argv[1], &default_addr, &err) < 0)
|
||||
die(1, "%s\n", err.msg);
|
||||
|
||||
gettimeofday(&start_time, NULL);
|
||||
@ -777,7 +777,7 @@ int main(int argc, char **argv)
|
||||
case 'L':
|
||||
/* silently ignore existing connections */
|
||||
if (sock == -1)
|
||||
sock = tcp_listen(&ss, argv[arg]);
|
||||
sock = tcp_listen(&default_addr, argv[arg]);
|
||||
if (sock < 0)
|
||||
die(1, "Fatal: tcp_listen() failed.\n");
|
||||
break;
|
||||
@ -785,7 +785,7 @@ int main(int argc, char **argv)
|
||||
case 'C':
|
||||
/* silently ignore existing connections */
|
||||
if (sock == -1)
|
||||
sock = tcp_connect(&ss, argv[arg]);
|
||||
sock = tcp_connect(&default_addr, argv[arg]);
|
||||
if (sock < 0)
|
||||
die(1, "Fatal: tcp_connect() failed.\n");
|
||||
dolog("connect\n");
|
||||
|
Loading…
Reference in New Issue
Block a user