#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* virtual IDataSocket*
accept() = 0; 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 // ISocket overrides

View File

@ -93,14 +93,3 @@ SecureListenSocket::accept()
throw ex; 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 // IListenSocket overrides
virtual IDataSocket* virtual IDataSocket*
accept(); accept();
void deleteSocket(void*);
private: private:
typedef std::set<IDataSocket*> SecureSocketSet; typedef std::set<IDataSocket*> SecureSocketSet;

View File

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

View File

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

View File

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

View File

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