mirror of
https://github.com/SantaSpeen/BeamMP-Server.git
synced 2026-04-06 07:46:13 +00:00
update players info
This commit is contained in:
committed by
Anonymous275
parent
bca4b3f140
commit
13f8be5d39
@@ -19,7 +19,13 @@ TTCPServer::TTCPServer(TServer& Server, TPPSMonitor& PPSMonitor, TResourceManage
|
||||
: mServer(Server)
|
||||
, mPPSMonitor(PPSMonitor)
|
||||
, mResourceManager(ResourceManager) {
|
||||
Application::RegisterShutdownHandler([this] { mShutdown = true; });
|
||||
Application::RegisterShutdownHandler([&] {if (mThread.joinable()) {
|
||||
debug("shutting down TCPServer");
|
||||
mShutdown = true;
|
||||
// FIXME: Join once TCPServer can timeout on a read, accept, etc.
|
||||
mThread.detach();
|
||||
debug("shut down TCPServer");
|
||||
} });
|
||||
Start();
|
||||
}
|
||||
|
||||
@@ -282,6 +288,7 @@ void TTCPServer::TCPClient(std::weak_ptr<TClient> c) {
|
||||
}
|
||||
|
||||
void TTCPServer::UpdatePlayers() {
|
||||
debug("Update Players!");
|
||||
std::string Packet = ("Ss") + std::to_string(mServer.ClientCount()) + "/" + std::to_string(Application::Settings.MaxPlayers) + ":";
|
||||
mServer.ForEachClient([&](std::weak_ptr<TClient> ClientPtr) -> bool {
|
||||
if (!ClientPtr.expired()) {
|
||||
@@ -368,8 +375,8 @@ void TTCPServer::SyncResources(TClient& c) {
|
||||
}
|
||||
#ifndef DEBUG
|
||||
} catch (std::exception& e) {
|
||||
except("Exception! : " + std::string(e.what()));
|
||||
c->SetStatus(-1);
|
||||
error("Exception! : " + std::string(e.what()));
|
||||
c.SetStatus(-1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -651,3 +658,5 @@ void TTCPServer::operator()() {
|
||||
CloseSocketProper(client);
|
||||
#endif
|
||||
}
|
||||
TTCPServer::~TTCPServer() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user