mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2026-03-14 14:35:44 +01:00
Use tagged switch instead of comparison where sensible.
This commit is contained in:
parent
32a86fdd76
commit
24dd3f08ef
6 changed files with 18 additions and 12 deletions
|
|
@ -271,7 +271,8 @@ func (c *Client) Close() {
|
|||
|
||||
func (c *Client) doClose() {
|
||||
closed := c.closed.Add(1)
|
||||
if closed == 1 {
|
||||
switch closed {
|
||||
case 1:
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
if c.conn != nil {
|
||||
|
|
@ -279,7 +280,7 @@ func (c *Client) doClose() {
|
|||
c.conn.Close()
|
||||
c.conn = nil
|
||||
}
|
||||
} else if closed == 2 {
|
||||
case 2:
|
||||
// Both the read pump and message processing must be finished before closing.
|
||||
c.closer.Close()
|
||||
<-c.messagesDone
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue