Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions remoting/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ func removePendingResponse(seq SequenceType) *PendingResponse {
return nil
}

// RemovePendingResponse removes and returns the pending response for the given sequence ID.
// It is the exported version of removePendingResponse for use by external packages.
func RemovePendingResponse(seq SequenceType) *PendingResponse {
return removePendingResponse(seq)
}
Comment on lines +187 to +191

// GetPendingResponse gets the response
func GetPendingResponse(seq SequenceType) *PendingResponse {
if presp, ok := pendingResponses.Load(seq); ok {
Expand Down
2 changes: 2 additions & 0 deletions remoting/exchange_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ func (client *ExchangeClient) Request(invocation *base.Invocation, url *common.U
err := client.client.Request(request, timeout, rsp)
// request error
if err != nil {
removePendingResponse(SequenceType(request.ID))
res.Err = err
return err
}
Expand Down Expand Up @@ -165,6 +166,7 @@ func (client *ExchangeClient) AsyncRequest(invocation *base.Invocation, url *com

err := client.client.Request(request, timeout, rsp)
if err != nil {
removePendingResponse(SequenceType(request.ID))
result.Err = err
return err
}
Expand Down
1 change: 1 addition & 0 deletions remoting/getty/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ func heartbeat(session getty.Session, timeout time.Duration, callBack func(err e
select {
case <-gxtime.After(timeout):
err1 = errHeartbeatReadTimeout
remoting.RemovePendingResponse(remoting.SequenceType(req.ID))
Comment on lines 355 to +357
case <-resp.Done:
err1 = resp.Err
}
Expand Down
Loading