Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wyang5 committed Jun 2, 2024
1 parent f47c5de commit 15708d5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pub.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,9 @@ func (w *pubMWriter) Close() error {
defer w.mu.Unlock()

for conn := range w.subscribers {
w.rmConn(conn)
_ = conn.Close()
}
w.subscribers = nil
return nil
}

Expand Down Expand Up @@ -281,7 +282,7 @@ func (w *pubMWriter) write(ctx context.Context, msg Msg) error {
select {
case <-ctx.Done():
return ctx.Err()
case channel <- msg: // will block if the channel is full
case channel <- msg: // proceeds to default case if the channel is full (msg will be discarded)
default:
}
}
Expand Down

0 comments on commit 15708d5

Please sign in to comment.