From: Guus Sliepen Date: Sun, 11 May 2014 22:24:15 +0000 (+0200) Subject: Immediately try connecting to the mesh after a succesful join. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=refs%2Fheads%2Finvite-protocol;p=meshlink Immediately try connecting to the mesh after a succesful join. --- diff --git a/src/meshlink.c b/src/meshlink.c index 8b731900..4aadaaa9 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -536,8 +536,15 @@ static bool finalize_join(meshlink_handle_t *mesh) { sptps_send_record(&(mesh->sptps), 1, b64key, strlen(b64key)); free(b64key); + free(mesh->self->name); + free(mesh->self->connection->name); + mesh->self->name = xstrdup(name); + mesh->self->connection->name = xstrdup(name); + fprintf(stderr, "Configuration stored in: %s\n", mesh->confbase); + load_all_nodes(mesh); + return true; } diff --git a/src/net.h b/src/net.h index 3fed3d0f..1c590b72 100644 --- a/src/net.h +++ b/src/net.h @@ -94,6 +94,7 @@ extern void send_packet(struct meshlink_handle *mesh, struct node_t *, struct vp extern void receive_tcppacket(struct meshlink_handle *mesh, struct connection_t *, const char *, int); extern void broadcast_packet(struct meshlink_handle *mesh, const struct node_t *, struct vpn_packet_t *); extern char *get_name(struct meshlink_handle *mesh); +extern void load_all_nodes(struct meshlink_handle *mesh); extern bool setup_myself_reloadable(struct meshlink_handle *mesh); extern bool setup_network(struct meshlink_handle *mesh); extern void setup_outgoing_connection(struct meshlink_handle *mesh, struct outgoing_t *); diff --git a/src/net_setup.c b/src/net_setup.c index 298a1819..69b6e86a 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -124,7 +124,7 @@ static bool read_invitation_key(meshlink_handle_t *mesh) { return mesh->invitation_key; } -static void load_all_nodes(meshlink_handle_t *mesh) { +void load_all_nodes(meshlink_handle_t *mesh) { DIR *dir; struct dirent *ent; char dname[PATH_MAX]; diff --git a/src/protocol_auth.c b/src/protocol_auth.c index 4910a930..908f5656 100644 --- a/src/protocol_auth.c +++ b/src/protocol_auth.c @@ -163,6 +163,9 @@ static bool finalize_invitation(meshlink_handle_t *mesh, connection_t *c, const //TODO: callback to application to inform of an accepted invitation sptps_send_record(&c->sptps, 2, data, 0); + + load_all_nodes(mesh); + return true; }