chore(protocol): don't start connection routines a second time (#10146)
This commit is contained in:
@@ -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
|
// 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() {
|
func (c *rawConnection) Start() {
|
||||||
c.startStopMut.Lock()
|
c.startStopMut.Lock()
|
||||||
defer c.startStopMut.Unlock()
|
defer c.startStopMut.Unlock()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
|
case <-c.started:
|
||||||
|
return
|
||||||
case <-c.closed:
|
case <-c.closed:
|
||||||
// we have already closed the connection before starting processing
|
// we have already closed the connection before starting processing
|
||||||
// on it.
|
// on it.
|
||||||
|
|||||||
Reference in New Issue
Block a user