From 19b51c9b92aae2997e6471e001f01ab419555244 Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Mon, 29 Apr 2019 17:52:57 +0200 Subject: [PATCH] lib/protocol: Don't close asyncMessage.done on success (fixes #5674) (#5675) --- lib/protocol/protocol.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/protocol/protocol.go b/lib/protocol/protocol.go index ca9292f3..96b41bd6 100644 --- a/lib/protocol/protocol.go +++ b/lib/protocol/protocol.go @@ -641,9 +641,9 @@ func (c *rawConnection) handleResponse(resp Response) { c.awaitingMut.Unlock() } -func (c *rawConnection) send(msg message, done chan struct{}) bool { +func (c *rawConnection) send(msg message, done chan struct{}) (sent bool) { defer func() { - if done != nil { + if !sent && done != nil { close(done) } }()