summaryrefslogtreecommitdiffstats
path: root/src/socket
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-12-30 02:30:16 +0000
committerDavid Robillard <d@drobilla.net>2013-12-30 02:30:16 +0000
commit927a89c98b6e55305bfe7853906f2b5cc13f463f (patch)
tree5211c422780725162db8252c4ccf4ade55d4e2fc /src/socket
parent24a2add27496e43e99dbc259ca7c26fbd5e43cff (diff)
downloadingen-927a89c98b6e55305bfe7853906f2b5cc13f463f.tar.gz
ingen-927a89c98b6e55305bfe7853906f2b5cc13f463f.tar.bz2
ingen-927a89c98b6e55305bfe7853906f2b5cc13f463f.zip
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
Diffstat (limited to 'src/socket')
-rw-r--r--src/socket/ingen_socket_server.cpp10
1 files changed, 8 insertions, 2 deletions
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<int32_t>();
@@ -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;