]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Comments
authorMatt Joiner <anacrolix@gmail.com>
Thu, 29 Jan 2015 03:17:27 +0000 (14:17 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 29 Jan 2015 03:17:27 +0000 (14:17 +1100)
client.go
dht/dht.go
dht/getpeers.go

index 52618b5c715c4da8c900a127588779f4254bdd28..11be66800083fa2415fbba0422da3023ed9ce602 100644 (file)
--- a/client.go
+++ b/client.go
@@ -1729,6 +1729,8 @@ func (cl *Client) AddMagnet(uri string) (T Torrent, err error) {
        return
 }
 
+// Actively prunes unused connections. This is required to make space to dial
+// for replacements.
 func (cl *Client) connectionPruner(t *torrent) {
        for {
                time.Sleep(15 * time.Second)
index 06cdfcdae47045a834e6e700d35c204f1afef458..350d6d1dae4a883b5b8fef004e55d0cb311074b5 100644 (file)
@@ -856,6 +856,7 @@ func (t *transaction) setOnResponse(f func(m Msg)) {
        t.onResponse = f
 }
 
+// Add response nodes to node table.
 func (s *Server) liftNodes(d Msg) {
        if d["y"] != "r" {
                return
index c507809c207572cdbdf169bb3cd72064d503ac7e..e58a0358a5679b9bc6a99dcce7d8f4ffa71171fd 100644 (file)
@@ -1,5 +1,7 @@
 package dht
 
+// get_peers and announce_peers.
+
 import (
        "log"
        "time"
@@ -121,6 +123,7 @@ func (me *peerDiscovery) getPeers(addr dHTAddr) error {
        go func() {
                select {
                case m := <-t.Response:
+                       // Register suggested nodes closer to the target info-hash.
                        me.mu.Lock()
                        for _, n := range m.Nodes() {
                                me.responseNode(n)
@@ -160,6 +163,8 @@ type peerStreamValue struct {
        NodeInfo                    // The node that gave the response.
 }
 
+// TODO: This was to be the shared publicly accessible part returned by DHT
+// functions that stream peers. Possibly not necessary anymore.
 type peerStream struct {
        mu     sync.Mutex
        Values chan peerStreamValue