Skip to content

Commit

Permalink
Try to fix #94 by eliminating the contention with a new struct copy.
Browse files Browse the repository at this point in the history
  • Loading branch information
ncabatoff committed Jul 21, 2020
1 parent 1831df7 commit 0321369
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,11 @@ func (c *Client) Do(req *Request) (*http.Response, error) {
return nil, req.Context().Err()
case <-time.After(wait):
}

// Make shallow copy of http Request so that we can modify its body
// without racing against the closeBody call in persistConn.writeLoop.
httpreq := *req.Request
req.Request = &httpreq
}

// this is the closest we have to success criteria
Expand Down

0 comments on commit 0321369

Please sign in to comment.