summaryrefslogtreecommitdiffstats
path: root/source/cClientHandle.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-26 13:55:42 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-26 13:55:42 +0100
commit7268a70902b04e098b6b530986d9ce6d210fdd07 (patch)
tree4c4a28b6e5fa03a58f3a787505bb02eca200082e /source/cClientHandle.cpp
parentUsing cSocketThreads for client outgoing packets. Unfortunately had to put in one intermediate thread (cServer::cNotifyWriteThread) to avoid deadlocks. Still, seems we have a proper multithreading for clients and no more per-client threads, yay :) (diff)
downloadcuberite-7268a70902b04e098b6b530986d9ce6d210fdd07.tar
cuberite-7268a70902b04e098b6b530986d9ce6d210fdd07.tar.gz
cuberite-7268a70902b04e098b6b530986d9ce6d210fdd07.tar.bz2
cuberite-7268a70902b04e098b6b530986d9ce6d210fdd07.tar.lz
cuberite-7268a70902b04e098b6b530986d9ce6d210fdd07.tar.xz
cuberite-7268a70902b04e098b6b530986d9ce6d210fdd07.tar.zst
cuberite-7268a70902b04e098b6b530986d9ce6d210fdd07.zip
Diffstat (limited to '')
-rw-r--r--source/cClientHandle.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index 41d2fda6c..4a6a0b508 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -165,6 +165,10 @@ cClientHandle::~cClientHandle()
cPacket_Chat Left(m_Username + " left the game!");
World->Broadcast(Left, this);
}
+ if (World != NULL)
+ {
+ World->RemovePlayer(m_Player);
+ }
}
if (m_Socket.IsValid())
@@ -209,6 +213,10 @@ cClientHandle::~cClientHandle()
// Queue the socket to close as soon as it sends all outgoing data:
cRoot::Get()->GetServer()->QueueClientClose(&m_Socket);
+ // We need to remove the socket from SocketThreads because we own it and it gets destroyed after this destructor finishes
+ // TODO: The socket needs to stay alive, someone else has to own it
+ cRoot::Get()->GetServer()->RemoveClient(&m_Socket);
+
LOG("ClientHandle at %p deleted", this);
}