mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-10-23 23:45:03 +00:00
try to request piece receive in have message
This commit is contained in:
1 parent
d717209125
commit
e9bc797ba8
1 file changed
+13
@@ -760,7 +760,20 @@ namespace torrents
|
||||
if (len < 4) return;
|
||||
uint32_t index = bufbe32toh (buf);
|
||||
if (index < m_RemoteBitfield.size ())
|
||||
{
|
||||
m_RemoteBitfield.set (index);
|
||||
if (m_NumRequests < MAX_NUM_REQUESTS && m_Torrent && !m_Torrent->IsComplete ())
|
||||
{
|
||||
Piece& piece = m_Torrent->GetPiece (index);
|
||||
if (!piece.IsComplete () && !piece.IsRequested ())
|
||||
{
|
||||
// new piece that was not requested yet
|
||||
auto [offset, len] = piece.GetNextBlockToRequest ();
|
||||
if (len > 0)
|
||||
SendRequestMsg (index, offset, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PeerConnection::SendHaveMsg (uint32_t index)
|
||||
|
||||
Reference in new issue
Block a user