dht: Use passive from server config
This commit is contained in:
parent
3204e276f2
commit
74d3598656
|
@ -50,7 +50,6 @@ type Server struct {
|
||||||
nodes map[string]*node // Keyed by dHTAddr.String().
|
nodes map[string]*node // Keyed by dHTAddr.String().
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
closed chan struct{}
|
closed chan struct{}
|
||||||
passive bool // Don't respond to queries.
|
|
||||||
ipBlockList *iplist.IPList
|
ipBlockList *iplist.IPList
|
||||||
badNodes *boom.BloomFilter
|
badNodes *boom.BloomFilter
|
||||||
|
|
||||||
|
@ -139,7 +138,6 @@ func NewServer(c *ServerConfig) (s *Server, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.passive = c.Passive
|
|
||||||
s.bootstrapNodes = c.BootstrapNodes
|
s.bootstrapNodes = c.BootstrapNodes
|
||||||
err = s.init()
|
err = s.init()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -722,7 +720,7 @@ func (s *Server) handleQuery(source dHTAddr, m Msg) {
|
||||||
node.SetIDFromString(args["id"].(string))
|
node.SetIDFromString(args["id"].(string))
|
||||||
node.lastGotQuery = time.Now()
|
node.lastGotQuery = time.Now()
|
||||||
// Don't respond.
|
// Don't respond.
|
||||||
if s.passive {
|
if s.config.Passive {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
switch m["q"] {
|
switch m["q"] {
|
||||||
|
|
Loading…
Reference in New Issue