From 511d7a826c0051a00c4b803780f7f9b3fd40106e Mon Sep 17 00:00:00 2001 From: Jeromy Date: Fri, 28 Oct 2016 17:09:45 -0700 Subject: [PATCH] increase refcount before dropping dialsLk initially --- dial_sync.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dial_sync.go b/dial_sync.go index 734901f..69739e5 100644 --- a/dial_sync.go +++ b/dial_sync.go @@ -36,7 +36,6 @@ type activeDial struct { } func (dr *activeDial) wait(ctx context.Context) (*Conn, error) { - dr.incref() defer dr.decref() select { case <-dr.waitch: @@ -97,6 +96,9 @@ func (ds *DialSync) getActiveDial(p peer.ID) *activeDial { go actd.start(adctx) } + // increase ref count before dropping dialsLk + actd.incref() + return actd } -- GitLab