From 70546f25a0209c2b61dadf61840dfa628a9a75b7 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 29 Sep 2012 19:43:34 +0000 Subject: SocketThread: clients aren't double-removed anymore. git-svn-id: http://mc-server.googlecode.com/svn/trunk@909 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/OSSupport/SocketThreads.cpp | 21 --------------------- source/OSSupport/SocketThreads.h | 1 - source/Player.cpp | 5 ++++- 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/source/OSSupport/SocketThreads.cpp b/source/OSSupport/SocketThreads.cpp index dd961770d..13336a0c4 100644 --- a/source/OSSupport/SocketThreads.cpp +++ b/source/OSSupport/SocketThreads.cpp @@ -530,8 +530,6 @@ void cSocketThreads::cSocketThread::Execute(void) } WriteToSockets(&fdWrite); - - RemoveClosedSockets(); } // while (!mShouldTerminate) } @@ -681,22 +679,3 @@ void cSocketThreads::cSocketThread::WriteToSockets(fd_set * a_Write) - -void cSocketThreads::cSocketThread::RemoveClosedSockets(void) -{ - // Removes sockets that have been queued for closing from m_Slots[] - - cCSLock Lock(m_Parent->m_CS); - for (int i = m_NumSlots - 1; i >= 0; --i) - { - if (!m_Slots[i].m_ShouldClose || !m_Slots[i].m_Outgoing.empty()) - { - continue; - } - m_Slots[i] = m_Slots[--m_NumSlots]; - } // for i - m_Slots[] -} - - - - diff --git a/source/OSSupport/SocketThreads.h b/source/OSSupport/SocketThreads.h index 974270a11..ecbac3aeb 100644 --- a/source/OSSupport/SocketThreads.h +++ b/source/OSSupport/SocketThreads.h @@ -149,7 +149,6 @@ private: void PrepareSet (fd_set * a_Set, cSocket::xSocket & a_Highest); // Puts all sockets into the set, along with m_ControlSocket1 void ReadFromSockets(fd_set * a_Read); // Reads from sockets indicated in a_Read void WriteToSockets (fd_set * a_Write); // Writes to sockets indicated in a_Write - void RemoveClosedSockets(void); // Removes sockets that have closed from m_Slots[] } ; typedef std::list cSocketThreadList; diff --git a/source/Player.cpp b/source/Player.cpp index b20287750..a0be947bf 100644 --- a/source/Player.cpp +++ b/source/Player.cpp @@ -66,6 +66,9 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName) m_CurrentWindow = m_InventoryWindow; m_InventoryWindow->OpenedByPlayer(*this); + // DEBUG: + LOGD("Inventory window for player %p is at %p", this, m_InventoryWindow); + SetMaxHealth(20); m_MaxFoodLevel = 20; m_MaxFoodSaturationLevel = 20.f; @@ -103,7 +106,7 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName) cPlayer::~cPlayer(void) { - LOG("Deleting cPlayer \"%s\" at %p, ID %d", m_PlayerName.c_str(), this, GetUniqueID()); + LOG("Deleting cPlayer \"%s\" at %p, ID %d; inv win %p", m_PlayerName.c_str(), this, GetUniqueID(), m_InventoryWindow); SaveToDisk(); -- cgit v1.2.3