mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-08-29 07:38:39 +00:00
release requested piece if connection got closed
This commit is contained in:
@@ -524,6 +524,12 @@ namespace torrents
|
||||
void PeerConnection::Terminate ()
|
||||
{
|
||||
if (Kill()) return;
|
||||
if (m_Torrent && m_LastRequestedPieceIndex >= 0) // pending requests by us
|
||||
{
|
||||
auto& piece = m_Torrent->GetPiece (m_LastRequestedPieceIndex);
|
||||
if (piece.IsRequested ())
|
||||
piece.Reset (); // piece can be requested by other connections
|
||||
}
|
||||
if (m_Stream)
|
||||
{
|
||||
m_Stream->Close ();
|
||||
|
||||
Reference in New Issue
Block a user