From: Matt Joiner Date: Thu, 29 Jan 2015 03:17:27 +0000 (+1100) Subject: Comments X-Git-Tag: v1.0.0~1357 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=04e5880d090ebd0550b8a17182529a4b8a1af516;p=btrtrc.git Comments --- diff --git a/client.go b/client.go index 52618b5c..11be6680 100644 --- 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) diff --git a/dht/dht.go b/dht/dht.go index 06cdfcda..350d6d1d 100644 --- a/dht/dht.go +++ b/dht/dht.go @@ -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 diff --git a/dht/getpeers.go b/dht/getpeers.go index c507809c..e58a0358 100644 --- a/dht/getpeers.go +++ b/dht/getpeers.go @@ -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