Skip to content

Commit

Permalink
extension/websocket: fix Accept blocked when listener closed
Browse files Browse the repository at this point in the history
  • Loading branch information
lesismal committed Jan 1, 2024
1 parent f4ea71f commit be90e91
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions extension/protocol/websocket/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func (ln *Listener) Handler(w http.ResponseWriter, r *http.Request) {
case <-ln.chClose:
c.Close()
}

}

// Close .
Expand All @@ -64,9 +63,10 @@ func (ln *Listener) Addr() net.Addr {

// Accept .
func (ln *Listener) Accept() (net.Conn, error) {
c := <-ln.chAccept
if c != nil {
select {
case c := <-ln.chAccept:
return c, nil
case <-ln.chClose:
}
return nil, ErrClosed
}
Expand Down

0 comments on commit be90e91

Please sign in to comment.