}
if(outgoing->state == OUTGOING_KNOWN) {
- if(outgoing->aip || get_recent(mesh, outgoing)) {
- if(get_next_ai(mesh, outgoing)) {
- return true;
- } else {
- free_known_addresses(outgoing->ai);
- outgoing->ai = NULL;
- outgoing->aip = NULL;
- }
+ if(!outgoing->aip) {
+ get_recent(mesh, outgoing);
+ } else {
+ outgoing->aip = outgoing->aip->ai_next;
+ }
+
+ if(outgoing->aip) {
+ return true;
+ } else {
+ free_known_addresses(outgoing->ai);
+ outgoing->ai = NULL;
+ outgoing->aip = NULL;
}
outgoing->state = OUTGOING_END;
return;
}
+ if(mesh->connection_try_cb) {
+ node_t *n = lookup_node(mesh, outgoing->name);
+ mesh->connection_try_cb(mesh, (struct meshlink_node *)n);
+ }
+
do_outgoing_connection(mesh, outgoing);
}
meshlink_handle_t *mesh = loop->data;
listen_socket_t *l = data;
connection_t *c;
- sockaddr_t sa = {0};
+ sockaddr_t sa;
int fd;
socklen_t len = sizeof(sa);
+ memset(&sa, 0, sizeof(sa));
+
fd = accept(l->tcp.fd, &sa.sa, &len);
if(fd < 0) {