Skip to content

Commit 7e358e9

Browse files
committed
robustsession: return from sendRequest() when context is canceled
1 parent a2a47f2 commit 7e358e9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

robustsession/robustsession.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,9 @@ func (s *RobustSession) String() string {
318318

319319
func (s *RobustSession) sendRequest(ctx context.Context, method, path string, data []byte) (string, *http.Response, error) {
320320
for !s.isDeleted() {
321+
if err := ctx.Err(); err != nil {
322+
return "", nil, err
323+
}
321324
// GET requests are for read-only state and can be answered by any server.
322325
target := s.network.server(method == "GET")
323326
requrl := fmt.Sprintf("https://%s%s", target, path)

0 commit comments

Comments
 (0)