Skip to content

Commit

Permalink
fix: connection reader block
Browse files Browse the repository at this point in the history
  • Loading branch information
yywing committed Sep 27, 2023
1 parent 654ac24 commit 9a861ae
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -862,13 +862,14 @@ func (c *Connection) call(req message, res ...message) error {
}
}

msg, ok := <-c.rpc
if !ok {
err, errorsChanIsOpen := <-c.errors
if !errorsChanIsOpen {
return ErrClosed
var msg message
select {
case e, ok := <-c.errors:
if ok {
return e
}
return err
return ErrClosed
case msg = <-c.rpc:
}

// Try to match one of the result types
Expand Down

0 comments on commit 9a861ae

Please sign in to comment.