]> git.meshlink.io Git - meshlink/commitdiff
open listening sockets at meshlink_start() and not at meshlink_open()
authorSaverio Proto <zioproto@gmail.com>
Sat, 7 Jun 2014 11:49:58 +0000 (13:49 +0200)
committerSaverio Proto <zioproto@gmail.com>
Sat, 7 Jun 2014 11:49:58 +0000 (13:49 +0200)
src/meshlink.c

index 7ea3e440b0f941d773c06eba53a267b0199b7508..b57eb21b7f604d413cf2e31070d2b652e02833d5 100644 (file)
@@ -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