diff options
Diffstat (limited to 'src/net/connectionhandler.cpp')
-rw-r--r-- | src/net/connectionhandler.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/net/connectionhandler.cpp b/src/net/connectionhandler.cpp index 123dc0b7..22fadc4c 100644 --- a/src/net/connectionhandler.cpp +++ b/src/net/connectionhandler.cpp @@ -30,12 +30,16 @@ #include "net/netcomputer.hpp" #include "utils/logger.h" -bool ConnectionHandler::startListen(enet_uint16 port) +bool ConnectionHandler::startListen(enet_uint16 port, + const std::string &listenHost) { // Bind the server to the default localhost. address.host = ENET_HOST_ANY; address.port = port; + if (!listenHost.empty()) + enet_address_set_host(&address, listenHost.c_str()); + LOG_INFO("Listening on port " << port << "..."); host = enet_host_create( &address /* the address to bind the server host to */, @@ -43,7 +47,7 @@ bool ConnectionHandler::startListen(enet_uint16 port) 0 /* assume any amount of incoming bandwidth */, 0 /* assume any amount of outgoing bandwidth */); - return host; + return host != 0; } void ConnectionHandler::stopListen() |