mirror of
https://github.com/transmission/transmission
synced 2024-12-25 17:17:31 +00:00
Send the correct bitfield in the bitfield message.
This commit is contained in:
parent
3ea3455a4a
commit
18c171d0ae
1 changed files with 5 additions and 4 deletions
|
@ -250,12 +250,13 @@ 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;
|
||||
uint8_t * p;
|
||||
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 a new issue