mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-25 16:10:57 +00:00
We need to detach on all errors or the Peer structure will stay in memory
forever.
This commit is contained in:
8
Peer.cpp
8
Peer.cpp
@@ -32,6 +32,13 @@ void Peer::handle_write(const boost::system::error_code& error, size_t bytes_tra
|
||||
#endif
|
||||
|
||||
mSendingPacket=PackedMessage::pointer();
|
||||
|
||||
if(error)
|
||||
{
|
||||
detach();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!mSendQ.empty())
|
||||
{
|
||||
PackedMessage::pointer packet=mSendQ.front();
|
||||
@@ -45,6 +52,7 @@ void Peer::handle_write(const boost::system::error_code& error, size_t bytes_tra
|
||||
|
||||
void Peer::detach()
|
||||
{
|
||||
mSendQ.erase();
|
||||
mSocket.close();
|
||||
if(!!mHanko) theApp->getConnectionPool().delFromMap(mHanko);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user