From: Guus Sliepen Date: Fri, 6 Nov 2015 21:56:34 +0000 (+0100) Subject: meshlink_start() now fails when the listening socket could not be opened. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=7b98381a4fcf38d98c72dcee908c43500efd493e;p=meshlink meshlink_start() now fails when the listening socket could not be opened. --- diff --git a/src/meshlink.c b/src/meshlink.c index 1d682c40..c67be830 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -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