Add: use Game Coordinator to annouce public servers

This commit is contained in:
Patric Stout
2021-07-03 11:04:32 +02:00
committed by Patric Stout
parent e1e2212e0e
commit b1280fd17e
13 changed files with 569 additions and 39 deletions

View File

@@ -19,6 +19,7 @@
#include "network_udp.h"
#include "network_gamelist.h"
#include "network_base.h"
#include "network_coordinator.h"
#include "core/udp.h"
#include "core/host.h"
#include "network_gui.h"
@@ -591,6 +592,8 @@ void NetworkClose(bool close_admins)
}
ServerNetworkGameSocketHandler::CloseListeners();
ServerNetworkAdminSocketHandler::CloseListeners();
_network_coordinator_client.CloseConnection();
} else if (MyClient::my_client != nullptr) {
MyClient::SendQuit();
MyClient::my_client->CloseConnection(NETWORK_RECV_STATUS_CLIENT_QUIT);
@@ -932,6 +935,10 @@ bool NetworkServerStart()
NetworkInitGameInfo();
if (_settings_client.network.server_advertise) {
_network_coordinator_client.Register();
}
/* execute server initialization script */
IConsoleCmdExec("exec scripts/on_server.scr 0");
/* if the server is dedicated ... add some other script */
@@ -1032,6 +1039,7 @@ static void NetworkSend()
void NetworkBackgroundLoop()
{
_network_content_client.SendReceive();
_network_coordinator_client.SendReceive();
TCPConnecter::CheckCallbacks();
NetworkHTTPSocketHandler::HTTPReceive();