Send the correct bitfield in the bitfield message.
This commit is contained in:
parent
3ea3455a4a
commit
18c171d0ae
|
@ -251,11 +251,12 @@ static void sendHave( tr_peer_t * peer, int piece )
|
|||
static void sendBitfield( tr_torrent_t * tor, tr_peer_t * peer )
|
||||
{
|
||||
uint8_t * p;
|
||||
int bitfieldSize = ( tor->info.pieceCount + 7 ) / 8;
|
||||
tr_bitfield_t * bitfield;
|
||||
|
||||
p = getMessagePointer( peer, bitfieldSize, PEER_MSG_BITFIELD );
|
||||
bitfield = tr_cpPieceBitfield( tor->completion );
|
||||
p = getMessagePointer( peer, bitfield->len, PEER_MSG_BITFIELD );
|
||||
|
||||
memcpy( p, tr_cpPieceBitfield( tor->completion ), bitfieldSize );
|
||||
memcpy( p, bitfield->bits, bitfield->len );
|
||||
|
||||
peer_dbg( "SEND bitfield" );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue