Add ClientConfig.AlwaysWantConns
This commit is contained in:
parent
c1744e37be
commit
4ca47eb358
|
@ -451,6 +451,9 @@ func (cl *Client) ipIsBlocked(ip net.IP) bool {
|
|||
}
|
||||
|
||||
func (cl *Client) wantConns() bool {
|
||||
if cl.config.AlwaysWantConns {
|
||||
return true
|
||||
}
|
||||
for _, t := range cl.torrents {
|
||||
if t.wantConns() {
|
||||
return true
|
||||
|
|
|
@ -139,6 +139,9 @@ type ClientConfig struct {
|
|||
DropMutuallyCompletePeers bool
|
||||
// Whether to accept peer connections at all.
|
||||
AcceptPeerConnections bool
|
||||
// Whether a Client should want conns without delegating to any attached Torrents. This is
|
||||
// useful when torrents might be added dynmically in callbacks for example.
|
||||
AlwaysWantConns bool
|
||||
|
||||
// OnQuery hook func
|
||||
DHTOnQuery func(query *krpc.Msg, source net.Addr) (propagate bool)
|
||||
|
|
Loading…
Reference in New Issue