summaryrefslogtreecommitdiffstats
path: root/src/OSSupport
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-01-18 20:50:16 +0100
committermadmaxoft <github@xoft.cz>2014-01-19 16:15:56 +0100
commitdc70d04cddee5d4888fa22854d291bfee0cfc293 (patch)
tree02432a817a0c6f62791b3197d3dc2c36fd3f0c20 /src/OSSupport
parentUpdated core (diff)
downloadcuberite-dc70d04cddee5d4888fa22854d291bfee0cfc293.tar
cuberite-dc70d04cddee5d4888fa22854d291bfee0cfc293.tar.gz
cuberite-dc70d04cddee5d4888fa22854d291bfee0cfc293.tar.bz2
cuberite-dc70d04cddee5d4888fa22854d291bfee0cfc293.tar.lz
cuberite-dc70d04cddee5d4888fa22854d291bfee0cfc293.tar.xz
cuberite-dc70d04cddee5d4888fa22854d291bfee0cfc293.tar.zst
cuberite-dc70d04cddee5d4888fa22854d291bfee0cfc293.zip
Diffstat (limited to 'src/OSSupport')
-rw-r--r--src/OSSupport/SocketThreads.cpp51
-rw-r--r--src/OSSupport/SocketThreads.h5
2 files changed, 3 insertions, 53 deletions
diff --git a/src/OSSupport/SocketThreads.cpp b/src/OSSupport/SocketThreads.cpp
index 3e505616c..b222a2e4e 100644
--- a/src/OSSupport/SocketThreads.cpp
+++ b/src/OSSupport/SocketThreads.cpp
@@ -71,29 +71,6 @@ bool cSocketThreads::AddClient(const cSocket & a_Socket, cCallback * a_Client)
-/*
-void cSocketThreads::RemoveClient(const cSocket * a_Socket)
-{
- // Remove the socket (and associated client) from processing
-
- cCSLock Lock(m_CS);
- for (cSocketThreadList::iterator itr = m_Threads.begin(); itr != m_Threads.end(); ++itr)
- {
- if ((*itr)->RemoveSocket(a_Socket))
- {
- return;
- }
- } // for itr - m_Threads[]
-
- // Cannot assert here, this may actually happen legally, since cClientHandle has to clean up the socket and it may have already closed in the meantime
- // ASSERT(!"Removing an unknown socket");
-}
-*/
-
-
-
-
-
void cSocketThreads::RemoveClient(const cCallback * a_Client)
{
// Remove the associated socket and the client from processing
@@ -284,34 +261,6 @@ bool cSocketThreads::cSocketThread::RemoveClient(const cCallback * a_Client)
-bool cSocketThreads::cSocketThread::RemoveSocket(const cSocket * a_Socket)
-{
- // Returns true if removed, false if not found
-
- for (int i = m_NumSlots - 1; i >= 0 ; --i)
- {
- if (m_Slots[i].m_Socket != *a_Socket)
- {
- continue;
- }
-
- // Found, remove it:
- m_Slots[i] = m_Slots[--m_NumSlots];
-
- // Notify the thread of the change:
- ASSERT(m_ControlSocket2.IsValid());
- m_ControlSocket2.Send("r", 1);
- return true;
- } // for i - m_Slots[]
-
- // Not found
- return false;
-}
-
-
-
-
-
bool cSocketThreads::cSocketThread::HasClient(const cCallback * a_Client) const
{
for (int i = m_NumSlots - 1; i >= 0; --i)
diff --git a/src/OSSupport/SocketThreads.h b/src/OSSupport/SocketThreads.h
index 858729c49..e16ae69fb 100644
--- a/src/OSSupport/SocketThreads.h
+++ b/src/OSSupport/SocketThreads.h
@@ -81,7 +81,9 @@ public:
/// Add a (socket, client) pair for processing, data from a_Socket is to be sent to a_Client; returns true if successful
bool AddClient(const cSocket & a_Socket, cCallback * a_Client);
- /// Remove the associated socket and the client from processing. The socket is left to send its data and is removed only after all its m_OutgoingData is sent
+ /** Remove the associated socket and the client from processing.
+ The socket is left to send its data and is removed only after all its m_OutgoingData is sent
+ */
void RemoveClient(const cCallback * a_Client);
/// Notify the thread responsible for a_Client that the client has something to write
@@ -114,7 +116,6 @@ private:
void AddClient (const cSocket & a_Socket, cCallback * a_Client); // Takes ownership of the socket
bool RemoveClient(const cCallback * a_Client); // Returns true if removed, false if not found
- bool RemoveSocket(const cSocket * a_Socket); // Returns true if removed, false if not found
bool HasClient (const cCallback * a_Client) const;
bool HasSocket (const cSocket * a_Socket) const;
bool NotifyWrite (const cCallback * a_Client); // Returns true if client handled by this thread