Commit b3377755 authored by Matt Joiner's avatar Matt Joiner

Improve context use

parent 94b3bc9b
...@@ -27,12 +27,7 @@ type dialJob struct { ...@@ -27,12 +27,7 @@ type dialJob struct {
} }
func (dj *dialJob) cancelled() bool { func (dj *dialJob) cancelled() bool {
select { return dj.ctx.Err() != nil
case <-dj.ctx.Done():
return true
default:
return false
}
} }
func (dj *dialJob) dialTimeout() time.Duration { func (dj *dialJob) dialTimeout() time.Duration {
......
...@@ -74,7 +74,9 @@ func (s *Swarm) AddListenAddr(a ma.Multiaddr) error { ...@@ -74,7 +74,9 @@ func (s *Swarm) AddListenAddr(a ma.Multiaddr) error {
for { for {
c, err := list.Accept() c, err := list.Accept()
if err != nil { 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 return
} }
log.Debugf("swarm listener accepted connection: %s", c) 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