From: Saverio Proto Date: Sat, 7 Jun 2014 11:49:58 +0000 (+0200) Subject: open listening sockets at meshlink_start() and not at meshlink_open() X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=1bad176f8d6be0bf8890b5efeaae0d1b4bdb1281;p=meshlink open listening sockets at meshlink_start() and not at meshlink_open() --- diff --git a/src/meshlink.c b/src/meshlink.c index 7ea3e440..b57eb21b 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -773,11 +773,6 @@ meshlink_handle_t *meshlink_open(const char *confbase, const char *name) { WSAStartup(MAKEWORD(2, 2), &wsa_state); #endif - // Setup up everything - // TODO: we should not open listening sockets yet - - if(!setup_network(mesh)) - return meshlink_close(mesh), NULL; return mesh; } @@ -800,6 +795,10 @@ bool meshlink_start(meshlink_handle_t *mesh) { fprintf(stderr, "No name given!\n"); return false; } + // Setup up everything + + if(!setup_network(mesh)) + return meshlink_close(mesh), NULL; // Start the main thread