| Class | RubyTorrent::Controller |
| In: |
lib/rubytorrent/controller.rb
|
| Parent: | Object |
The Controller manages all PeerConnections for a single Package. It instructs them to request blocks, and tells them whether to choke their connections or not. It also reports progress to the tracker.
Incoming, post-handshake peer connections are added by the Server via calling add_connection; deciding to accept these is the Controller‘s responsibility, as is connecting to any new peers.
| HEARTBEAT | = | 5 | general behavior parameters | |
| MAX_PEERS | = | 15 | ||
| ENDGAME_PIECE_THRESH | = | 5 | ||
| FUSEKI_PIECE_THRESH | = | 2 | before we trigger end-game mode | |
| SPAWN_NEW_PEER_THRESH | = | 0.75 | getting out of fuseki mode. in fuseki ("opening", if you‘re not a weiqi/go fan) mode, rather than ranking pieces by rarity, we rank them by how distant their popularity is from (# peers) / 2, and we‘re also stingly in handing out requests. | |
| RATE_WINDOW | = | 20 | which we‘ll stop making new peer connections | |
| DEAD_TRACKER_INITIAL_INTERVAL | = | 5 | tracker parameters. when we can‘t access a tracker, we retry at DEAD_TRACKER_INITIAL_DELAY seconds and double that after every failure, capping at DEAD_TRACKER_MAX_DELAY. | |
| DEAD_TRACKER_MAX_INTERVAL | = | 3600 | ||
| KEEPALIVE_INTERVAL | = | 120 | single peer parameters | |
| SILENT_DEATH_INTERVAL | = | 240 | ||
| BOREDOM_DEATH_INTERVAL | = | 120 | ||
| BLOCK_SIZE | = | 2**15 | at which we drop a peer in favor of an incoming peer (unless the package is complete) | |
| ANTISNUB_RATE_THRESH | = | 1024 | antisnubbing | |
| ANTISNUB_INTERVAL | = | 60 | peers falls below this threshold, we trigger anti-snubbing mode | |
| NUM_FRIENDS | = | 4 | choking and optimistic unchoking parameters | |
| CALC_FRIENDS_INTERVAL | = | 10 | ||
| CALC_OPTUNCHOKES_INTERVAL | = | 30 | status for each peer | |
| NUM_OPTUNCHOKES | = | 1 | optimistic unchoked status | |
| NEW_OPTUNCHOKE_PROB | = | 0.5 | (not including any temporary ones generated in anti-snubbing mode. |
| dlratelim | [RW] | their connection, and optimistic unchoking slots are given with probability p*(1-p)^r, where r is the rank and p is this number. |
| http_proxy | [RW] | their connection, and optimistic unchoking slots are given with probability p*(1-p)^r, where r is the rank and p is this number. |
| info_hash | [RW] | their connection, and optimistic unchoking slots are given with probability p*(1-p)^r, where r is the rank and p is this number. |
| package | [RW] | their connection, and optimistic unchoking slots are given with probability p*(1-p)^r, where r is the rank and p is this number. |
| tracker | [RW] | their connection, and optimistic unchoking slots are given with probability p*(1-p)^r, where r is the rank and p is this number. |
| ulratelim | [RW] | their connection, and optimistic unchoking slots are given with probability p*(1-p)^r, where r is the rank and p is this number. |
this could be called at any point by the Server, if it receives incoming peer connections.