Renamed handleLANRequest to HandleDirectSocketRequest, since the code

can also be used to connect to a public server (outside of the server's LAN).
This commit is contained in:
hiker 2016-12-01 10:11:50 +11:00
parent fc5cecceae
commit 09ca38d36e
2 changed files with 11 additions and 7 deletions

View File

@ -540,7 +540,7 @@ void* STKHost::mainLoop(void* self)
{ {
if(myself->m_lan_network) if(myself->m_lan_network)
{ {
myself->handleLANRequests(); myself->handleDirectSocketRequest();
} // if discovery host } // if discovery host
while (enet_host_service(host, &event, 20) != 0) while (enet_host_service(host, &event, 20) != 0)
@ -585,11 +585,15 @@ void* STKHost::mainLoop(void* self)
} // mainLoop } // mainLoop
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/** Handles LAN related messages. It checks for any LAN broadcast messages, /** Handles a direct request given to a socket. This is typically a LAN
* and if a valid LAN server-request message is received, will answer * request, but can also be used if the server is public (i.e. not behind
* with a message containing server details (and sender IP address and port). * 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; const int LEN=2048;
char buffer[LEN]; char buffer[LEN];
@ -632,7 +636,7 @@ void STKHost::handleLANRequests()
Log::info("STKHost", "Received unknown command '%s'", Log::info("STKHost", "Received unknown command '%s'",
std::string(buffer, len).c_str()); std::string(buffer, len).c_str());
} // handleLANRequests } // handleDirectSocketRequest
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/** \brief Tells if a peer is known. /** \brief Tells if a peer is known.

View File

@ -109,7 +109,7 @@ private:
STKHost(const irr::core::stringw &server_name); STKHost(const irr::core::stringw &server_name);
virtual ~STKHost(); virtual ~STKHost();
void init(); void init();
void handleLANRequests(); void handleDirectSocketRequest();
public: public:
/** If a network console should be started. Note that the console can cause /** If a network console should be started. Note that the console can cause