Skip to content

Commit

Permalink
We should also abort when the writer context is cancelled.
Browse files Browse the repository at this point in the history
  • Loading branch information
encse committed Aug 25, 2023
1 parent a7c9a4a commit 099cec7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rep.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ func (r *repWriter) rmConn(conn *Conn) {
func (r *repWriter) write(ctx context.Context, msg Msg) error {
conn, preamble := r.state.Get()
select {
case <-ctx.Done():
return ctx.Err()
case <-r.ctx.Done(): // repWriter.run() terminates on this, sendCh <- will not complete
return r.ctx.Err()
case r.sendCh <- repSendPayload{conn, preamble, msg}:
Expand Down

0 comments on commit 099cec7

Please sign in to comment.