Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions rpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,16 @@ func (c *Client) dispatch(codec ServerCodec, connCtx context.Context) {
// Remove response handlers for the last send. When the read loop
// goes down, it will signal all other current operations.
conn.handler.removeRequestOp(lastOp)
} else if !reading {
// The write succeeded but the connection is already dead (read
// loop exited with an error). The in-flight request was excluded
// from cancelAllRequests so it could be re-registered on a
// reconnected connection, but no reconnect happened because the
// write did not fail. Cancel it now to avoid blocking forever.
if lastOp != nil {
lastOp.err = errDead
close(lastOp.resp)
}
}
// Let the next request in.
reqInitLock = c.reqInit
Expand Down
Loading