From 72880446d8b19caf6154fea2c363ae3fa8b1883d Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 27 Jul 2008 14:10:32 +0000 Subject: [PATCH] (daemon) #1107: transmission-remote -t[n] -i should display webseeding info --- libtransmission/peer-mgr.c | 19 ++++++++----------- libtransmission/peer-msgs.c | 16 ++++++++-------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.c index beeebe739..c6f43c5d4 100644 --- a/libtransmission/peer-mgr.c +++ b/libtransmission/peer-mgr.c @@ -43,12 +43,8 @@ enum /* how frequently to change which peers are choked */ RECHOKE_PERIOD_MSEC = (10 * 1000), - /* how frequently to refill peers' request lists */ - REFILL_PERIOD_MSEC = 666, - - /* following the BT spec, we consider ourselves `snubbed' if - * we're we don't get piece data from a peer in this long */ - SNUBBED_SEC = 60, + /* minimum interval for refilling peers' request lists */ + REFILL_PERIOD_MSEC = 333, /* when many peers are available, keep idle ones this long */ MIN_UPLOAD_IDLE_SECS = (60 * 3), @@ -66,7 +62,8 @@ enum * this throttle is to avoid overloading the router */ MAX_CONNECTIONS_PER_SECOND = 8, - /* number of unchoked peers per torrent */ + /* number of unchoked peers per torrent. + * FIXME: this probably ought to be configurable */ MAX_UNCHOKED_PEERS = 12, /* number of bad pieces a peer is allowed to send before we ban them */ @@ -1526,8 +1523,8 @@ tr_peerMgrPeerStats( const tr_peerMgr * manager, struct ChokeData { - uint8_t doUnchoke; - uint8_t isInterested; + unsigned int doUnchoke : 1; + unsigned int isInterested : 1; uint32_t rate; tr_peer * peer; }; @@ -1811,8 +1808,8 @@ getPeerCandidates( Torrent * t, int * setmeSize ) * hold off on this peer to give another one a try instead */ if( ( now - atom->piece_data_time ) > 30 ) { - int minWait = (60 * 10); /* ten minutes */ - int maxWait = (60 * 30); /* thirty minutes */ + int minWait = (60 * 5); /* five minutes */ + int maxWait = minWait * 3; int wait = atom->numFails * minWait; if( wait < minWait ) wait = minWait; if( wait > maxWait ) wait = maxWait; diff --git a/libtransmission/peer-msgs.c b/libtransmission/peer-msgs.c index cbc005097..7e422f2c2 100644 --- a/libtransmission/peer-msgs.c +++ b/libtransmission/peer-msgs.c @@ -88,8 +88,8 @@ enum /* used in lowering the outMessages queue period */ IMMEDIATE_PRIORITY_INTERVAL_SECS = 0, - HIGH_PRIORITY_INTERVAL_SECS = 5, - LOW_PRIORITY_INTERVAL_SECS = 30 + HIGH_PRIORITY_INTERVAL_SECS = 2, + LOW_PRIORITY_INTERVAL_SECS = 20 }; /** @@ -288,6 +288,11 @@ struct tr_peermsgs uint16_t minActiveRequests; uint16_t maxActiveRequests; + /* how long the outMessages batch should be allowed to grow before + * it's flushed -- some messages (like requests >:) should be sent + * very quickly; others aren't as urgent. */ + int outMessagesBatchPeriod; + tr_peer * info; tr_handle * handle; @@ -313,11 +318,6 @@ struct tr_peermsgs /* when we started batching the outMessages */ time_t outMessagesBatchedAt; - - /* how long the outMessages batch should be allowed to grow before - * it's flushed -- some messages (like requests >:) should be sent - * very quickly; others aren't as urgent. */ - int outMessagesBatchPeriod; tr_bitfield * peerAllowedPieces; @@ -1670,7 +1670,7 @@ pulse( void * vmsgs ) len -= outlen; msgs->clientSentAnythingAt = now; - msgs->sendingBlock = len!=0; + msgs->sendingBlock = len != 0; dbgmsg( msgs, "wrote %d bytes; %d left in block", (int)outlen, (int)len ); } -- 2.40.0