]> granicus.if.org Git - transmission/commitdiff
(daemon) #1107: transmission-remote -t[n] -i should display webseeding info
authorCharles Kerr <charles@transmissionbt.com>
Sun, 27 Jul 2008 14:10:32 +0000 (14:10 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Sun, 27 Jul 2008 14:10:32 +0000 (14:10 +0000)
libtransmission/peer-mgr.c
libtransmission/peer-msgs.c

index beeebe7395ea0cb568977e7b5e4ec89500579fc2..c6f43c5d44bdf241b15841b5a7f27bb5d28402e6 100644 (file)
@@ -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;
index cbc005097827a94ec791c1c054d148d9d30ef2df..7e422f2c2fa2a178b4cef7606ad1c7c257c36bdc 100644 (file)
@@ -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 );
         }