1
0
Fork 0
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:
Josh Elsasser 2007-03-09 01:43:10 +00:00
parent 3ea3455a4a
commit 18c171d0ae

View file

@ -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" );
} }