Commit b3377755 authored by Matt Joiner's avatar Matt Joiner

Improve context use

parent 94b3bc9b
......@@ -27,12 +27,7 @@ type dialJob struct {
}
func (dj *dialJob) cancelled() bool {
select {
case <-dj.ctx.Done():
return true
default:
return false
}
return dj.ctx.Err() != nil
}
func (dj *dialJob) dialTimeout() time.Duration {
......
......@@ -74,7 +74,9 @@ func (s *Swarm) AddListenAddr(a ma.Multiaddr) error {
for {
c, err := list.Accept()
if err != nil {
log.Warningf("swarm listener accept error: %s", err)
if s.ctx.Err() == nil {
log.Errorf("swarm listener accept error: %s", err)
}
return
}
log.Debugf("swarm listener accepted connection: %s", c)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment