Rename peer source constants
This commit is contained in:
parent
93de711d42
commit
289293f3cc
2
Peer.go
2
Peer.go
@ -21,7 +21,7 @@ type Peer struct {
|
|||||||
func (me *Peer) FromPex(na krpc.NodeAddr, fs peer_protocol.PexPeerFlags) {
|
func (me *Peer) FromPex(na krpc.NodeAddr, fs peer_protocol.PexPeerFlags) {
|
||||||
me.IP = append([]byte(nil), na.IP...)
|
me.IP = append([]byte(nil), na.IP...)
|
||||||
me.Port = na.Port
|
me.Port = na.Port
|
||||||
me.Source = peerSourcePEX
|
me.Source = peerSourcePex
|
||||||
// If they prefer encryption, they must support it.
|
// If they prefer encryption, they must support it.
|
||||||
if fs.Get(peer_protocol.PexPrefersEncryption) {
|
if fs.Get(peer_protocol.PexPrefersEncryption) {
|
||||||
me.SupportsEncryption = true
|
me.SupportsEncryption = true
|
||||||
|
@ -1254,7 +1254,7 @@ func (cl *Client) onDHTAnnouncePeer(ih metainfo.Hash, ip net.IP, port int, portO
|
|||||||
t.addPeers([]Peer{{
|
t.addPeers([]Peer{{
|
||||||
IP: ip,
|
IP: ip,
|
||||||
Port: port,
|
Port: port,
|
||||||
Source: peerSourceDHTAnnouncePeer,
|
Source: peerSourceDhtAnnouncePeer,
|
||||||
}})
|
}})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,9 +31,9 @@ type peerSource string
|
|||||||
const (
|
const (
|
||||||
peerSourceTracker = "Tr"
|
peerSourceTracker = "Tr"
|
||||||
peerSourceIncoming = "I"
|
peerSourceIncoming = "I"
|
||||||
peerSourceDHTGetPeers = "Hg" // Peers we found by searching a DHT.
|
peerSourceDhtGetPeers = "Hg" // Peers we found by searching a DHT.
|
||||||
peerSourceDHTAnnouncePeer = "Ha" // Peers that were announced to us by a DHT.
|
peerSourceDhtAnnouncePeer = "Ha" // Peers that were announced to us by a DHT.
|
||||||
peerSourcePEX = "X"
|
peerSourcePex = "X"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Maintains the state of a connection with a peer.
|
// Maintains the state of a connection with a peer.
|
||||||
|
@ -1341,7 +1341,7 @@ func (t *Torrent) consumeDhtAnnouncePeers(pvs <-chan dht.PeersValues) {
|
|||||||
t.addPeer(Peer{
|
t.addPeer(Peer{
|
||||||
IP: cp.IP[:],
|
IP: cp.IP[:],
|
||||||
Port: cp.Port,
|
Port: cp.Port,
|
||||||
Source: peerSourceDHTGetPeers,
|
Source: peerSourceDhtGetPeers,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
cl.unlock()
|
cl.unlock()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user