diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-03-05 18:15:56 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-03-05 18:15:56 +0100 |
commit | 0df305e226b6858e56ac6f690c735fb219e155f8 (patch) | |
tree | 84fb91facf7ee396f4abf2b1a08a3359e78c6b02 /source/cServer.cpp | |
parent | Using a fixed-size array instead of AString for conversion. Conversion now runs ~10x faster :) (in debug mode) (diff) | |
download | cuberite-0df305e226b6858e56ac6f690c735fb219e155f8.tar cuberite-0df305e226b6858e56ac6f690c735fb219e155f8.tar.gz cuberite-0df305e226b6858e56ac6f690c735fb219e155f8.tar.bz2 cuberite-0df305e226b6858e56ac6f690c735fb219e155f8.tar.lz cuberite-0df305e226b6858e56ac6f690c735fb219e155f8.tar.xz cuberite-0df305e226b6858e56ac6f690c735fb219e155f8.tar.zst cuberite-0df305e226b6858e56ac6f690c735fb219e155f8.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cServer.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/cServer.cpp b/source/cServer.cpp index 3b85a45c4..116861aca 100644 --- a/source/cServer.cpp +++ b/source/cServer.cpp @@ -353,31 +353,36 @@ bool cServer::Tick(float a_Dt) cRoot::Get()->TickWorlds( a_Dt ); // TODO - Maybe give all worlds their own thread?
+ cClientHandleList RemoveClients;
{
cCSLock Lock(m_CSClients);
for (cClientHandleList::iterator itr = m_Clients.begin(); itr != m_Clients.end();)
{
if ((*itr)->IsDestroyed())
{
- cClientHandle* RemoveMe = *itr;
+ RemoveClients.push_back(*itr); // Remove the client later, when CS is not held, to avoid deadlock ( http://forum.mc-server.org/showthread.php?tid=374 )
itr = m_Clients.erase(itr);
- delete RemoveMe;
continue;
}
(*itr)->Tick(a_Dt);
++itr;
- }
+ } // for itr - m_Clients[]
}
+ for (cClientHandleList::iterator itr = RemoveClients.begin(); itr != RemoveClients.end(); ++itr)
+ {
+ delete *itr;
+ } // for itr - RemoveClients[]
cRoot::Get()->GetPluginManager()->Tick( a_Dt );
if( !m_bRestarting )
+ {
return true;
+ }
else
{
m_bRestarting = false;
m_pState->RestartEvent.Set();
- LOG("<<<<>>>>SIGNALLED SEMAPHORE");
return false;
}
}
|