#5680 Stop deleting socket twice if it's been adopted by PacketStream

This commit is contained in:
Jerry (Xinyu Hou) 2016-10-18 16:48:32 +01:00
parent a6ff90794f
commit dc4beba9e9
7 changed files with 2 additions and 39 deletions

View File

@ -42,13 +42,6 @@ public:
virtual IDataSocket*
accept() = 0;
//! Delete connection socket
/*!
This is used when the socket was created but not adopted by a client
proxy.
*/
virtual void deleteSocket(void*) = 0;
//@}
// ISocket overrides

View File

@ -93,14 +93,3 @@ SecureListenSocket::accept()
throw ex;
}
}
void
SecureListenSocket::deleteSocket(void* socket)
{
SecureSocketSet::iterator it;
it = m_secureSocketSet.find((IDataSocket*)socket);
if (it != m_secureSocketSet.end()) {
delete *it;
m_secureSocketSet.erase(it);
}
}

View File

@ -33,7 +33,6 @@ public:
// IListenSocket overrides
virtual IDataSocket*
accept();
void deleteSocket(void*);
private:
typedef std::set<IDataSocket*> SecureSocketSet;

View File

@ -43,7 +43,6 @@ public:
// IListenSocket overrides
virtual IDataSocket*
accept();
virtual void deleteSocket(void*) { }
protected:
void setListeningJob();

View File

@ -106,12 +106,6 @@ ClientListener::setServer(Server* server)
m_server = server;
}
void
ClientListener::deleteSocket(void* socket)
{
m_listen->deleteSocket(socket);
}
ClientProxy*
ClientListener::getNextClient()
{
@ -213,10 +207,6 @@ ClientListener::handleUnknownClient(const Event&, void* vclient)
}
delete unknownClient;
if (m_useSecureNetwork && !handshakeOk) {
deleteSocket(socket);
}
}
void

View File

@ -48,8 +48,6 @@ public:
//@}
void deleteSocket(void* socket);
//! @name accessors
//@{

View File

@ -1378,10 +1378,7 @@ Server::handleClientDisconnected(const Event&, void* vclient)
removeActiveClient(client);
removeOldClient(client);
PacketStreamFilter* streamFileter = dynamic_cast<PacketStreamFilter*>(client->getStream());
TCPSocket* socket = dynamic_cast<TCPSocket*>(streamFileter->getStream());
delete client;
m_clientListener->deleteSocket(socket);
}
void
@ -1391,10 +1388,8 @@ Server::handleClientCloseTimeout(const Event&, void* vclient)
BaseClientProxy* client = static_cast<BaseClientProxy*>(vclient);
LOG((CLOG_NOTE "forced disconnection of client \"%s\"", getName(client).c_str()));
removeOldClient(client);
PacketStreamFilter* streamFileter = dynamic_cast<PacketStreamFilter*>(client->getStream());
TCPSocket* socket = dynamic_cast<TCPSocket*>(streamFileter->getStream());
delete client;
m_clientListener->deleteSocket(socket);
}
void