]> git.meshlink.io Git - meshlink/commitdiff
meshlink_start() now fails when the listening socket could not be opened.
authorGuus Sliepen <guus@meshlink.io>
Fri, 6 Nov 2015 21:56:34 +0000 (22:56 +0100)
committerGuus Sliepen <guus@meshlink.io>
Sun, 25 Jun 2017 08:33:06 +0000 (10:33 +0200)
src/meshlink.c

index 1d682c40b53b2d8bb9911450f9ab61d41c18572e..c67be83087ee7f32f17afbeae5cb4c6f4c6954bb 100644 (file)
@@ -944,6 +944,12 @@ bool meshlink_start(meshlink_handle_t *mesh) {
        
        logger(mesh, MESHLINK_DEBUG, "meshlink_start called\n");
 
+       if(mesh->listen_socket[0].tcp.fd < 0) {
+               logger(mesh, MESHLINK_ERROR, "Listening socket not open\n");
+               meshlink_errno = MESHLINK_ENETWORK;
+               return false;
+       }
+
        mesh->thedatalen = 0;
 
        // TODO: open listening sockets first