summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsweetgiorni <sweet.giorni@gmail.com>2017-01-03 21:39:39 +0100
committersweetgiorni <sweet.giorni@gmail.com>2017-01-03 22:14:28 +0100
commit6522385897788df4682a1744b17815c0767c46f8 (patch)
tree352aa5c7246b92cd61c70fd20fad9e36fd06faf7
parentTCPLink: call networking callbacks with LibEvent unlocked. (#3515) (diff)
downloadcuberite-6522385897788df4682a1744b17815c0767c46f8.tar
cuberite-6522385897788df4682a1744b17815c0767c46f8.tar.gz
cuberite-6522385897788df4682a1744b17815c0767c46f8.tar.bz2
cuberite-6522385897788df4682a1744b17815c0767c46f8.tar.lz
cuberite-6522385897788df4682a1744b17815c0767c46f8.tar.xz
cuberite-6522385897788df4682a1744b17815c0767c46f8.tar.zst
cuberite-6522385897788df4682a1744b17815c0767c46f8.zip
-rw-r--r--src/Root.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Root.cpp b/src/Root.cpp
index 80366e5c1..8390cac7b 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -339,16 +339,17 @@ void cRoot::StopServer()
virtual bool Item(cPlayer * a_Player)
{
a_Player->GetClientHandlePtr()->Kick(m_ShutdownMessage);
+ m_HasSentDisconnect = true;
return false;
}
public:
- cPlayerCallback(AString a_ShutdownMessage) : m_ShutdownMessage(a_ShutdownMessage) {}
- };
+ bool m_HasSentDisconnect;
+ cPlayerCallback(AString a_ShutdownMessage) : m_ShutdownMessage(a_ShutdownMessage) { m_HasSentDisconnect = false; }
+ } PlayerCallback(m_Server->GetShutdownMessage());
- if (m_Server->GetNumPlayers())
+ cRoot::Get()->ForEachPlayer(PlayerCallback);
+ if (PlayerCallback.m_HasSentDisconnect)
{
- cPlayerCallback PlayerCallback((m_Server->GetShutdownMessage()));
- cRoot::Get()->ForEachPlayer(PlayerCallback);
std::this_thread::sleep_for(std::chrono::seconds(1));
}
m_TerminateEventRaised = true;