Skip to content

Commit

Permalink
Fix deadlock in connctx.WriteContext
Browse files Browse the repository at this point in the history
  • Loading branch information
jkralik authored and daenney committed Dec 16, 2021
1 parent 78491f1 commit 538d788
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Atsushi Watanabe <atsushi.w@ieee.org>
backkem <mail@backkem.me>
Hugo Arregui <hugo.arregui@gmail.com>
Jozef Kralik <jojo.lwin@gmail.com>
Juliusz Chroboczek <jch@irif.fr>
Luke Curley <kixelated@gmail.com>
Mathis Engelbart <mathis.engelbart@gmail.com>
Expand Down
2 changes: 1 addition & 1 deletion connctx/connctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ func (c *connCtx) WriteContext(ctx context.Context, b []byte) (int, error) {
var errSetDeadline atomic.Value
wg.Add(1)
go func() {
defer wg.Done()
select {
case <-ctx.Done():
// context canceled
Expand All @@ -131,7 +132,6 @@ func (c *connCtx) WriteContext(ctx context.Context, b []byte) (int, error) {
}
case <-done:
}
wg.Done()
}()

n, err := c.nextConn.Write(b)
Expand Down

0 comments on commit 538d788

Please sign in to comment.