veyron/runtimes/google/ipc/client.go: Don't start a cancel goroutine for uncancellable contexts.
Change-Id: I9a7a193124991caa127b6d8290cc9f09c82f0463
diff --git a/runtimes/google/ipc/client.go b/runtimes/google/ipc/client.go
index 5511c15..358d78b 100644
--- a/runtimes/google/ipc/client.go
+++ b/runtimes/google/ipc/client.go
@@ -240,10 +240,12 @@
lastErr = nil
fc := newFlowClient(ctx, flow, &c.dischargeCache, discharges)
- go func() {
- <-ctx.Done()
- fc.Cancel()
- }()
+ if doneChan := ctx.Done(); doneChan != nil {
+ go func() {
+ <-ctx.Done()
+ fc.Cancel()
+ }()
+ }
if verr := fc.start(suffix, method, args, timeout, blessing); verr != nil {
return nil, verr