respect contexts when returning diagnostics responses

License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
This commit is contained in:
Jeromy 2016-11-03 23:44:42 -07:00
parent 1ca2d42889
commit 7728124b5e

View File

@ -191,7 +191,11 @@ func (d *Diagnostics) getDiagnosticFromPeers(ctx context.Context, peers map[peer
return
}
for d := range out {
respdata <- d
select {
case respdata <- d:
case <-ctx.Done():
return
}
}
}(p)
}