Add Peer.Torrent
This was for accessing from callback events.
This commit is contained in:
parent
31bbd435f9
commit
c069849b40
7
peer.go
7
peer.go
|
@ -126,6 +126,13 @@ const (
|
||||||
PeerSourceDirect = "M"
|
PeerSourceDirect = "M"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Returns the Torrent a Peer belongs to. Shouldn't change for the lifetime of the Peer. May be nil
|
||||||
|
// if we are the receiving end of a connection and the handshake hasn't been received or accepted
|
||||||
|
// yet.
|
||||||
|
func (p *Peer) Torrent() *Torrent {
|
||||||
|
return p.t
|
||||||
|
}
|
||||||
|
|
||||||
func (p *Peer) initRequestState() {
|
func (p *Peer) initRequestState() {
|
||||||
p.requestState.Requests = &peerRequests{}
|
p.requestState.Requests = &peerRequests{}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue