Don't send local_address in ADD_EDGE messages if it's AF_UNSPEC.
This commit is contained in:
parent
23fda4db6d
commit
30e839b0a1
1 changed files with 14 additions and 7 deletions
|
@ -37,19 +37,26 @@
|
|||
bool send_add_edge(connection_t *c, const edge_t *e) {
|
||||
bool x;
|
||||
char *address, *port;
|
||||
char *local_address, *local_port;
|
||||
|
||||
sockaddr2str(&e->address, &address, &port);
|
||||
sockaddr2str(&e->local_address, &local_address, &local_port);
|
||||
|
||||
x = send_request(c, "%d %x %s %s %s %s %x %d %s %s", ADD_EDGE, rand(),
|
||||
e->from->name, e->to->name, address, port,
|
||||
e->options, e->weight, local_address, local_port);
|
||||
if(e->local_address.sa.sa_family) {
|
||||
char *local_address, *local_port;
|
||||
sockaddr2str(&e->local_address, &local_address, &local_port);
|
||||
|
||||
x = send_request(c, "%d %x %s %s %s %s %x %d %s %s", ADD_EDGE, rand(),
|
||||
e->from->name, e->to->name, address, port,
|
||||
e->options, e->weight, local_address, local_port);
|
||||
free(local_address);
|
||||
free(local_port);
|
||||
} else {
|
||||
x = send_request(c, "%d %x %s %s %s %s %x %d", ADD_EDGE, rand(),
|
||||
e->from->name, e->to->name, address, port,
|
||||
e->options, e->weight);
|
||||
}
|
||||
|
||||
free(address);
|
||||
free(port);
|
||||
free(local_address);
|
||||
free(local_port);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue