Skip to content

Commit

Permalink
update logger
Browse files Browse the repository at this point in the history
  • Loading branch information
haoqixu committed Feb 6, 2024
1 parent 8d04fca commit 975b5fb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/wsclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,20 +256,20 @@ func (c *wsClient) runOneCycle(ctx context.Context) {
case <-c.sender.IsStopped():
// 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)
c.common.Logger.Debugf(ctx, "Error stopping the sender: %v", err)

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

c.common.Logger.Debugf("Waiting for receiver to stop.")
c.common.Logger.Debugf(ctx, "Waiting for receiver to stop.")
select {
case <-r.IsStopped():
c.common.Logger.Debugf("Receiver stopped.")
c.common.Logger.Debugf(ctx, "Receiver stopped.")
case <-time.After(c.connShutdownTimeout):
c.common.Logger.Debugf("Timeout waiting for receiver to stop.")
c.common.Logger.Debugf(ctx, "Timeout waiting for receiver to stop.")
// Close the connection to force the receive loop to stop.
_ = c.conn.Close()
<-r.IsStopped()
Expand Down

0 comments on commit 975b5fb

Please sign in to comment.