Changeset 7456 for trunk/libtransmission/peer-msgs.c
- Timestamp:
- Dec 22, 2008, 12:52:44 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/peer-msgs.c
r7448 r7456 402 402 403 403 static void 404 protocolSendRequest( tr_peermsgs *msgs,404 protocolSendRequest( tr_peermsgs * msgs, 405 405 const struct peer_request * req ) 406 406 { … … 420 420 421 421 static void 422 protocolSendCancel( tr_peermsgs *msgs,422 protocolSendCancel( tr_peermsgs * msgs, 423 423 const struct peer_request * req ) 424 424 { … … 448 448 tr_peerIoWriteUint32( io, out, index ); 449 449 450 dbgmsg( msgs, "sending Have %u ...", index );450 dbgmsg( msgs, "sending Have %u", index ); 451 451 dbgOutMessageLen( msgs ); 452 452 pokeBatchPeriod( msgs, LOW_PRIORITY_INTERVAL_SECS ); … … 773 773 tr_peerIoWriteUint32( msgs->peer->io, out, sizeof( uint8_t ) ); 774 774 tr_peerIoWriteUint8 ( msgs->peer->io, out, weAreInterested ? BT_INTERESTED : BT_NOT_INTERESTED ); 775 775 776 pokeBatchPeriod( msgs, HIGH_PRIORITY_INTERVAL_SECS ); 776 777 dbgOutMessageLen( msgs ); … … 876 877 oldestAllowed = now - QUEUED_REQUEST_TTL_SECS; 877 878 reqListCopy( &tmp, &msgs->clientWillAskFor ); 878 for( i = 0; i <tmp.count; ++i ) {879 for( i=0; i<tmp.count; ++i ) { 879 880 const struct peer_request * req = &tmp.requests[i]; 880 881 if( req->time_requested < oldestAllowed ) … … 934 935 if( sent ) 935 936 dbgmsg( msgs, "pump sent %d requests, now have %d active and %d queued", 936 sent, 937 msgs->clientAskedFor.count, 938 msgs->clientWillAskFor.count ); 937 sent, msgs->clientAskedFor.count, msgs->clientWillAskFor.count ); 939 938 940 939 if( count < max ) … … 953 952 uint32_t index, 954 953 uint32_t offset, 955 uint32_t length, 956 int doForce ) 954 uint32_t length ) 957 955 { 958 956 struct peer_request req; … … 967 965 968 966 /* don't send requests to choked clients */ 969 if( !doForce &&msgs->peer->clientIsChoked ) {967 if( msgs->peer->clientIsChoked ) { 970 968 dbgmsg( msgs, "declining request because they're choking us" ); 971 969 return TR_ADDREQ_CLIENT_CHOKED; … … 973 971 974 972 /* peer doesn't have this piece */ 975 if( ! doForce && !tr_bitfieldHas( msgs->peer->have, index ) )973 if( !tr_bitfieldHas( msgs->peer->have, index ) ) 976 974 return TR_ADDREQ_MISSING; 977 975 978 976 /* peer's queue is full */ 979 if( !doForce &&requestQueueIsFull( msgs ) ) {977 if( requestQueueIsFull( msgs ) ) { 980 978 dbgmsg( msgs, "declining request because we're full" ); 981 979 return TR_ADDREQ_FULL; … … 986 984 req.offset = offset; 987 985 req.length = length; 988 if( !doForce ) { 989 if( reqListFind( &msgs->clientAskedFor, &req ) != -1 ) { 990 dbgmsg( msgs, "declining because it's a duplicate" ); 991 return TR_ADDREQ_DUPLICATE; 992 } 993 if( reqListFind( &msgs->clientWillAskFor, &req ) != -1 ) { 994 dbgmsg( msgs, "declining because it's a duplicate" ); 995 return TR_ADDREQ_DUPLICATE; 996 } 986 if( reqListFind( &msgs->clientAskedFor, &req ) != -1 ) { 987 dbgmsg( msgs, "declining because it's a duplicate" ); 988 return TR_ADDREQ_DUPLICATE; 989 } 990 if( reqListFind( &msgs->clientWillAskFor, &req ) != -1 ) { 991 dbgmsg( msgs, "declining because it's a duplicate" ); 992 return TR_ADDREQ_DUPLICATE; 997 993 } 998 994 … … 1582 1578 break; 1583 1579 1584 1585 1580 case BT_FEXT_HAVE_NONE: 1586 1581 dbgmsg( msgs, "Got a BT_FEXT_HAVE_NONE" ); … … 1781 1776 size_t bytesWritten = 0; 1782 1777 struct peer_request req; 1783 const inthaveMessages = EVBUFFER_LENGTH( msgs->outMessages ) != 0;1778 const tr_bool haveMessages = EVBUFFER_LENGTH( msgs->outMessages ) != 0; 1784 1779 const tr_bool fext = tr_peerIoSupportsFEXT( msgs->peer->io ); 1785 1780 … … 1881 1876 tr_peerMsgsPulse( tr_peermsgs * msgs ) 1882 1877 { 1883 if( msgs )1878 if( msgs != NULL ) 1884 1879 peerPulse( msgs ); 1885 1880 } … … 2203 2198 tr_peermsgs* 2204 2199 tr_peerMsgsNew( struct tr_torrent * torrent, 2205 struct tr_peer *peer,2200 struct tr_peer * peer, 2206 2201 tr_delivery_func func, 2207 void *userData,2208 tr_publisher_tag *setme )2202 void * userData, 2203 tr_publisher_tag * setme ) 2209 2204 { 2210 2205 tr_peermsgs * m;
Note: See TracChangeset
for help on using the changeset viewer.