Skip to content

Commit

Permalink
Merge pull request #319 from aceld/feature/aceld
Browse files Browse the repository at this point in the history
fix close channel Write goroutins
  • Loading branch information
aceld authored Apr 25, 2024
2 parents a7a32fd + fd3a0a3 commit eb55d5f
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions znet/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,10 @@ func (c *Connection) SendToQueue(data []byte) error {
select {
case <-c.ctx.Done():
return errors.New("connection closed when send buff msg")
default:
select {
case <-idleTimeout.C:
return errors.New("send buff msg timeout")
case c.msgBuffChan <- data:
return nil
}
case <-idleTimeout.C:
return errors.New("send buff msg timeout")
case c.msgBuffChan <- data:
return nil
}
}

Expand Down

0 comments on commit eb55d5f

Please sign in to comment.