respect contexts when returning diagnostics responses
License: MIT Signed-off-by: Jeromy <why@ipfs.io>
Jeromy committed
Nov 3, 2016 at 23:44 UTC
7728124b5ee1a448916ff598b8acb1ebe7cfdad7
1 file changed
+5
-1
diagnostics/diag.go
+5
-1
@@ -191,7 +191,11 @@ func (d *Diagnostics) getDiagnosticFromPeers(ctx context.Context, peers map[peer
191
return
192
}
193
for d := range out {
194
- respdata <- d
194
+ select {
195
+ case respdata <- d:
196
+ case <-ctx.Done():
197
+ return
198
+ }
199
}
200
}(p)
201
}