From 4fb8ee6a6f3105b9dfcaa32c80680d533d87f3b7 Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Fri, 30 May 2025 06:28:42 +0000 Subject: [PATCH] chore(protocol): don't start connection routines a second time (#10146) --- lib/protocol/protocol.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/protocol/protocol.go b/lib/protocol/protocol.go index 37eaf49b3..30b6e8e70 100644 --- a/lib/protocol/protocol.go +++ b/lib/protocol/protocol.go @@ -265,12 +265,15 @@ func newRawConnection(deviceID DeviceID, reader io.Reader, writer io.Writer, clo } // Start creates the goroutines for sending and receiving of messages. It must -// be called exactly once after creating a connection. +// be called once after creating a connection. It should only be called once, +// subsequent calls will have no effect. func (c *rawConnection) Start() { c.startStopMut.Lock() defer c.startStopMut.Unlock() select { + case <-c.started: + return case <-c.closed: // we have already closed the connection before starting processing // on it.