mirror of
https://github.com/transmission/transmission
synced 2024-12-26 01:27:28 +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 )
|
static void sendBitfield( tr_torrent_t * tor, tr_peer_t * peer )
|
||||||
{
|
{
|
||||||
uint8_t * p;
|
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" );
|
peer_dbg( "SEND bitfield" );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue