Skip to content

Commit

Permalink
Fix race condition null pointer crash in bridge.go:313
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicletz committed Dec 3, 2024
1 parent 04b4643 commit 6b550d3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions rpc/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,17 @@ func (client *Client) recvMessageLoop() {
}()

for {
if client.s == nil {
if !client.isClosed {
client.Log().Info("Client connection closed prematurely.")
client.Close()
}
return
}
msg, err := client.s.readMessage()
if err != nil {
if !client.isClosed {
// This was unexpected...
client.Log().Info("Client connection closed: %v", err)
client.Log().Info("Client connection closed unexpectedly: %v", err)
client.Close()
}
return
Expand Down

0 comments on commit 6b550d3

Please sign in to comment.