mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-10-23 06:22:30 +00:00
release requested piece if connection got closed
This commit is contained in:
1 parent
71cec86bf7
commit
ab03c745a8
1 file changed
+6
@@ -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