connection_t *c = handle;
meshlink_handle_t *mesh = c->mesh;
+ // Extend the time for the invitation exchange upon receiving a valid message
+ c->last_ping_time = mesh->loop.now.tv_sec;
+
if(type == SPTPS_HANDSHAKE) {
// The peer should send its cookie first.
return true;
c->protocol_minor = 2;
c->allow_request = 1;
+ c->last_ping_time = mesh->loop.now.tv_sec;
return sptps_start(&c->sptps, c, false, false, mesh->invitation_key, c->ecdsa, meshlink_invitation_label, sizeof(meshlink_invitation_label), send_meta_sptps, receive_invitation_sptps);
}
}
c->allow_request = ACK;
+ c->last_ping_time = mesh->loop.now.tv_sec;
char label[sizeof(meshlink_tcp_label) + strlen(mesh->self->name) + strlen(c->name) + 2];
if(c->outgoing) {
}
bool send_ack(meshlink_handle_t *mesh, connection_t *c) {
+ c->last_ping_time = mesh->loop.now.tv_sec;
return send_request(mesh, c, NULL, "%d %s %d %x", ACK, mesh->myport, mesh->devclass, OPTION_PMTU_DISCOVERY | (PROT_MINOR << 24));
}
/* Send all known subnets and edges */
for splay_each(node_t, n, mesh->nodes) {
- for splay_each(edge_t, e, n->edge_tree) {
+ for inner_splay_each(edge_t, e, n->edge_tree) {
send_add_edge(mesh, c, e, 0);
}
}
n->last_successfull_connection = mesh->loop.now.tv_sec;
n->connection = c;
+ n->nexthop = n;
c->node = n;
/* Activate this connection */
logger(mesh, MESHLINK_INFO, "Connection with %s activated", c->name);
+ if(mesh->meta_status_cb) {
+ mesh->meta_status_cb(mesh, (meshlink_node_t *)n, true);
+ }
+
/* Send him everything we know */
send_everything(mesh, c);
c->edge->weight = mesh->dev_class_traits[devclass].edge_weight;
c->edge->connection = c;
+ node_add_recent_address(mesh, n, &c->address);
edge_add(mesh, c->edge);
/* Notify everyone of the new edge */
graph(mesh);
+ /* Request a session key to jump start UDP traffic */
+
+ if(c->status.initiator) {
+ send_req_key(mesh, n);
+ }
+
return true;
}