Skip to content

Commit

Permalink
client: refactor setConnected(disconnected) out of conditional
Browse files Browse the repository at this point in the history
c.setConnected(disconnected) was called inconditionally in both
conditions start so it is in fact independent of the status. Move
it out.
  • Loading branch information
ptsneves committed Mar 10, 2022
1 parent 7254d2c commit 3ec7db3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions client.go
Expand Up @@ -455,9 +455,9 @@ func (c *client) Disconnect(quiesce uint) {
defer c.disconnect()

status := atomic.LoadUint32(&c.status)
c.setConnected(disconnected)
if status == connected {
DEBUG.Println(CLI, "disconnecting")
c.setConnected(disconnected)

dm := packets.NewControlPacket(packets.Disconnect).(*packets.DisconnectPacket)
dt := newToken(packets.Disconnect)
Expand All @@ -479,7 +479,6 @@ func (c *client) Disconnect(quiesce uint) {
}
} else {
WARN.Println(CLI, "Disconnect() called but not connected (disconnected/reconnecting)")
c.setConnected(disconnected)
}

}
Expand Down

0 comments on commit 3ec7db3

Please sign in to comment.