Changeset 1554


Ignore:
Timestamp:
Mar 9, 2007, 1:41:45 AM (15 years ago)
Author:
joshe
Message:

Remove old message length check that was causing some messages to be ignored.
Send the correct bitfield in the bitfield message.

Location:
branches/pex/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/pex/libtransmission/peermessages.h

    r1540 r1554  
    188188static void sendKeepAlive( tr_peer_t * peer )
    189189{
    190     uint8_t * p;
    191 
    192     p = getMessagePointer( peer, 0, AZ_MSG_BT_KEEP_ALIVE );
     190    getMessagePointer( peer, 0, AZ_MSG_BT_KEEP_ALIVE );
    193191
    194192    peer_dbg( "SEND keep-alive" );
     
    203201static void sendChoke( tr_peer_t * peer, int yes )
    204202{
    205     uint8_t * p;
    206     int       id;
     203    int id;
    207204
    208205    id = ( yes ? PEER_MSG_CHOKE : PEER_MSG_UNCHOKE );
    209     p = getMessagePointer( peer, 0, id );
     206    getMessagePointer( peer, 0, id );
    210207
    211208    peer->amChoking = yes;
     
    228225static void sendInterest( tr_peer_t * peer, int yes )
    229226{
    230     uint8_t * p;
    231     int       id;
     227    int id;
    232228
    233229    id = ( yes ? PEER_MSG_INTERESTED : PEER_MSG_UNINTERESTED );
    234     p = getMessagePointer( peer, 0, id );
     230    getMessagePointer( peer, 0, id );
    235231
    236232    peer->amInterested = yes;
     
    265261static void sendBitfield( tr_torrent_t * tor, tr_peer_t * peer )
    266262{
    267     uint8_t * p;
    268     int       bitfieldSize = ( tor->info.pieceCount + 7 ) / 8;
    269 
    270     p = getMessagePointer( peer, bitfieldSize, PEER_MSG_BITFIELD );
    271 
    272     memcpy( p, tr_cpPieceBitfield( tor->completion ), bitfieldSize );
     263    uint8_t       * p;
     264    tr_bitfield_t * bitfield;
     265
     266    bitfield = tr_cpPieceBitfield( tor->completion );
     267    p = getMessagePointer( peer, bitfield->len, PEER_MSG_BITFIELD );
     268
     269    memcpy( p, bitfield->bits, bitfield->len );
    273270
    274271    peer_dbg( "SEND bitfield" );
  • branches/pex/libtransmission/peerparse.h

    r1540 r1554  
    732732        assert( 0 <= peer->pos );
    733733
    734         /* don't try to parse zero-length messages */
    735         if( !len )
    736         {
    737             continue;
    738         }
    739 
    740734        if( ( ret = parseMessage( tor, peer, msgid, p, len ) ) )
    741735        {
Note: See TracChangeset for help on using the changeset viewer.