From 007b96a62fdc67c47d10124ddeb4b20e1ae08cc0 Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Thu, 13 Jan 2011 01:58:57 +0000 Subject: [PATCH] (trunk libT) #3894 "tr_peerIo.hasFinishedConnecting should be removed" -- committed. --- libtransmission/peer-io.c | 16 +++++----------- libtransmission/peer-io.h | 8 +------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/libtransmission/peer-io.c b/libtransmission/peer-io.c index bfe303ab6..dff3823fb 100644 --- a/libtransmission/peer-io.c +++ b/libtransmission/peer-io.c @@ -214,7 +214,6 @@ event_read_cb( int fd, short event UNUSED, void * vio ) assert( tr_isPeerIo( io ) ); - io->hasFinishedConnecting = TRUE; io->pendingEvents &= ~EV_READ; curlen = evbuffer_get_length( io->inbuf ); @@ -290,7 +289,6 @@ event_write_cb( int fd, short event UNUSED, void * vio ) assert( tr_isPeerIo( io ) ); - io->hasFinishedConnecting = TRUE; io->pendingEvents &= ~EV_WRITE; dbgmsg( io, "libevent says this peer is ready to write" ); @@ -390,7 +388,6 @@ tr_peerIoNew( tr_session * session, io->port = port; io->socket = socket; io->isIncoming = isIncoming != 0; - io->hasFinishedConnecting = FALSE; io->timeCreated = tr_time( ); io->inbuf = evbuffer_new( ); io->outbuf = evbuffer_new( ); @@ -967,15 +964,12 @@ tr_peerIoFlush( tr_peerIo * io, tr_direction dir, size_t limit ) assert( tr_isPeerIo( io ) ); assert( tr_isDirection( dir ) ); - if( io->hasFinishedConnecting ) - { - if( dir == TR_DOWN ) - bytesUsed = tr_peerIoTryRead( io, limit ); - else - bytesUsed = tr_peerIoTryWrite( io, limit ); - } + if( dir == TR_DOWN ) + bytesUsed = tr_peerIoTryRead( io, limit ); + else + bytesUsed = tr_peerIoTryWrite( io, limit ); - dbgmsg( io, "flushing peer-io, hasFinishedConnecting %d, direction %d, limit %zu, bytesUsed %d", (int)io->hasFinishedConnecting, (int)dir, limit, bytesUsed ); + dbgmsg( io, "flushing peer-io, direction %d, limit %zu, bytesUsed %d", (int)dir, limit, bytesUsed ); return bytesUsed; } diff --git a/libtransmission/peer-io.h b/libtransmission/peer-io.h index 7885430f8..8f30c8a2b 100644 --- a/libtransmission/peer-io.h +++ b/libtransmission/peer-io.h @@ -72,11 +72,6 @@ typedef struct tr_peerIo tr_bool fastExtensionSupported; tr_bool dhtSupported; - /* we create the socket in a nonblocking way, so this flag is initially - * false and then set to true when libevent says that the socket is ready - * for reading or writing */ - tr_bool hasFinishedConnecting; - tr_priority_t priority; short int pendingEvents; @@ -340,8 +335,7 @@ tr_peerIoHasBandwidthLeft( const tr_peerIo * io, tr_direction dir ) { assert( tr_isPeerIo( io ) ); - return !io->hasFinishedConnecting - || ( tr_bandwidthClamp( &io->bandwidth, dir, 1024 ) > 0 ); + return tr_bandwidthClamp( &io->bandwidth, dir, 1024 ) > 0; } static inline unsigned int