Skip to content

Commit

Permalink
close connections explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
haoqixu committed Feb 6, 2024
1 parent 61d7baf commit 8d04fca
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/wsclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ func (c *wsClient) runOneCycle(ctx context.Context) {
// sender will send close message to initiate the close handshake
if err := c.sender.StoppingErr(); err != nil {
c.common.Logger.Debugf("Error stopping the sender: %v", err)

// Close the connection to stop the receiver.
_ = c.conn.Close()
<-r.IsStopped()
break
}

Expand Down

0 comments on commit 8d04fca

Please sign in to comment.