Changeset 7789
- Timestamp:
- Jan 24, 2009, 3:17:59 AM (12 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/bandwidth.c
r7748 r7789 209 209 tr_peerIoRef( peers[i] ); 210 210 211 /* Stop all peers from listening for the socket to be ready for IO.212 * See "Second phase of IO" lower in this function for more info. */213 for( i=0; i<peerCount; ++i )214 tr_peerIoSetEnabled( peers[i], dir, FALSE );215 216 211 /* First phase of IO. Tries to distribute bandwidth fairly to keep faster 217 212 * peers from starving the others. Loop through the peers, giving each a … … 247 242 * or (2) the next tr_bandwidthAllocate() call, when we start over again. */ 248 243 for( i=0; i<peerCount; ++i ) 249 if( tr_peerIoHasBandwidthLeft( peers[i], dir ) ) 250 tr_peerIoSetEnabled( peers[i], dir, TRUE ); 244 tr_peerIoSetEnabled( peers[i], dir, tr_peerIoHasBandwidthLeft( peers[i], dir ) ); 251 245 252 246 for( i=0; i<peerCount; ++i ) -
trunk/libtransmission/peer-io.c
r7770 r7789 824 824 } 825 825 826 dbgmsg( io, "flushing peer-io, direction %d, limit %zu, bytesUsed %d", (int)dir, limit, bytesUsed );826 dbgmsg( io, "flushing peer-io, hasFinishedConnecting %d, direction %d, limit %zu, bytesUsed %d", (int)io->hasFinishedConnecting, (int)dir, limit, bytesUsed ); 827 827 return bytesUsed; 828 828 } … … 835 835 event_enable( tr_peerIo * io, short event ) 836 836 { 837 if( event & EV_READ ) 837 if( event & EV_READ ) { 838 dbgmsg( io, "enabling libevent ready-to-read polling" ); 838 839 event_add( &io->event_read, NULL ); 839 840 if( event & EV_WRITE ) 840 } 841 842 if( event & EV_WRITE ) { 843 dbgmsg( io, "enabling libevent ready-to-write polling" ); 841 844 event_add( &io->event_write, NULL ); 845 } 842 846 } 843 847 … … 845 849 event_disable( struct tr_peerIo * io, short event ) 846 850 { 847 if( event & EV_READ ) 851 if( event & EV_READ ) { 852 dbgmsg( io, "disabling libevent ready-to-read polling" ); 848 853 event_del( &io->event_read ); 849 850 if( event & EV_WRITE ) 854 } 855 856 if( event & EV_WRITE ) { 857 dbgmsg( io, "disabling libevent ready-to-write polling" ); 851 858 event_del( &io->event_write ); 859 } 852 860 } 853 861 -
trunk/libtransmission/peer-io.h
r7770 r7789 328 328 329 329 static TR_INLINE void tr_peerIoSetParent( tr_peerIo * io, 330 struct tr_bandwidth * parent )330 struct tr_bandwidth * parent ) 331 331 { 332 332 assert( tr_isPeerIo( io ) ); … … 341 341 342 342 static TR_INLINE tr_bool tr_peerIoHasBandwidthLeft( const tr_peerIo * io, 343 tr_direction dir ) 344 { 345 assert( tr_isPeerIo( io ) ); 346 347 return tr_bandwidthClamp( &io->bandwidth, dir, 1024 ) > 0; 343 tr_direction dir ) 344 { 345 assert( tr_isPeerIo( io ) ); 346 347 return !io->hasFinishedConnecting 348 || ( tr_bandwidthClamp( &io->bandwidth, dir, 1024 ) > 0 ); 348 349 } 349 350
Note: See TracChangeset
for help on using the changeset viewer.