From 927a89c98b6e55305bfe7853906f2b5cc13f463f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 30 Dec 2013 02:30:16 +0000 Subject: Don't falsely report listening on sockets that failed to bind. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5224 a436a847-0d15-0410-975c-d299462d15a1 --- src/socket/ingen_socket_server.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/socket/ingen_socket_server.cpp b/src/socket/ingen_socket_server.cpp index b9bdc19c..5aff7179 100644 --- a/src/socket/ingen_socket_server.cpp +++ b/src/socket/ingen_socket_server.cpp @@ -50,8 +50,9 @@ ingen_listen(Ingen::World* world, if (!unix_sock->bind(unix_uri) || !unix_sock->listen()) { world->log().error("Failed to create UNIX socket\n"); unix_sock->close(); + } else { + world->log().info(fmt("Listening on socket %1%\n") % unix_uri); } - world->log().info(fmt("Listening on socket %1%\n") % unix_uri); // Bind TCP socket const int port = world->conf().option("engine-port").get(); @@ -61,8 +62,13 @@ ingen_listen(Ingen::World* world, if (!net_sock->bind(Raul::URI(ss.str())) || !net_sock->listen()) { world->log().error("Failed to create TCP socket\n"); net_sock->close(); + } else { + world->log().info(fmt("Listening on TCP port %1%\n") % port); + } + + if (unix_sock->fd() == -1 && net_sock->fd() == -1) { + return; // No sockets to listen to, exit thread } - world->log().info(fmt("Listening on TCP port %1%\n") % port); struct pollfd pfds[2]; int nfds = 0; -- cgit v1.2.1