Skip to content

Commit

Permalink
Close net connection first, to release blocked reader, then all pendi…
Browse files Browse the repository at this point in the history
…ng ops on that connection will be properly released.
  • Loading branch information
tinybit committed Aug 29, 2024
1 parent 14ebd32 commit 7591db5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,16 +210,16 @@ func (c *connect) close() error {
c.closed = true
c.mutexClose.Unlock()

if err := c.conn.Close(); err != nil {
return err
}

c.buffer = nil

c.mutex.Lock()
c.reader = nil
c.mutex.Unlock()

if err := c.conn.Close(); err != nil {
return err
}

return nil
}

Expand Down

0 comments on commit 7591db5

Please sign in to comment.