/* 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),
* 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 */
struct ChokeData
{
- uint8_t doUnchoke;
- uint8_t isInterested;
+ unsigned int doUnchoke : 1;
+ unsigned int isInterested : 1;
uint32_t rate;
tr_peer * peer;
};
* 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;
/* 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
};
/**
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;
/* 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;
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 );
}