From 7b98381a4fcf38d98c72dcee908c43500efd493e Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Fri, 6 Nov 2015 22:56:34 +0100 Subject: [PATCH] meshlink_start() now fails when the listening socket could not be opened. --- src/meshlink.c | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- 2.39.5