From 09ca38d36e0f0519c32efcc2b138abc18959d1a2 Mon Sep 17 00:00:00 2001 From: hiker Date: Thu, 1 Dec 2016 10:11:50 +1100 Subject: [PATCH] Renamed handleLANRequest to HandleDirectSocketRequest, since the code can also be used to connect to a public server (outside of the server's LAN). --- src/network/stk_host.cpp | 16 ++++++++++------ src/network/stk_host.hpp | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/network/stk_host.cpp b/src/network/stk_host.cpp index 9eb856489..aea6f170b 100644 --- a/src/network/stk_host.cpp +++ b/src/network/stk_host.cpp @@ -540,7 +540,7 @@ void* STKHost::mainLoop(void* self) { if(myself->m_lan_network) { - myself->handleLANRequests(); + myself->handleDirectSocketRequest(); } // if discovery host while (enet_host_service(host, &event, 20) != 0) @@ -585,11 +585,15 @@ void* STKHost::mainLoop(void* self) } // mainLoop // ---------------------------------------------------------------------------- -/** Handles LAN related messages. It checks for any LAN broadcast messages, - * and if a valid LAN server-request message is received, will answer - * with a message containing server details (and sender IP address and port). +/** Handles a direct request given to a socket. This is typically a LAN + * request, but can also be used if the server is public (i.e. not behind + * a fire wall) to allow direct connection to the server (without using the + * STK server). It checks for any messages (i.e. a LAN broadcast requesting + * server details or a connection request) and if a valid LAN server-request + * message is received, will answer with a message containing server details + * (and sender IP address and port). */ -void STKHost::handleLANRequests() +void STKHost::handleDirectSocketRequest() { const int LEN=2048; char buffer[LEN]; @@ -632,7 +636,7 @@ void STKHost::handleLANRequests() Log::info("STKHost", "Received unknown command '%s'", std::string(buffer, len).c_str()); -} // handleLANRequests +} // handleDirectSocketRequest // ---------------------------------------------------------------------------- /** \brief Tells if a peer is known. diff --git a/src/network/stk_host.hpp b/src/network/stk_host.hpp index 0f526fdb2..ae1be86e0 100644 --- a/src/network/stk_host.hpp +++ b/src/network/stk_host.hpp @@ -109,7 +109,7 @@ private: STKHost(const irr::core::stringw &server_name); virtual ~STKHost(); void init(); - void handleLANRequests(); + void handleDirectSocketRequest(); public: /** If a network console should be started. Note that the console can cause