summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/base/socket.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/base/socket.cc b/src/base/socket.cc
index 0c8903084..c39accd7e 100644
--- a/src/base/socket.cc
+++ b/src/base/socket.cc
@@ -103,11 +103,14 @@ ListenSocket::listen(int port, bool reuse)
return false;
}
- if (::listen(fd, 1) == -1)
- panic("ListenSocket(listen): listen() failed!");
+ if (::listen(fd, 1) == -1) {
+ if (errno != EADDRINUSE)
+ panic("ListenSocket(listen): listen() failed!");
- listening = true;
+ return false;
+ }
+ listening = true;
anyListening = true;
return true;
}