Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeouts and tears down connections on -noreuse #60

Merged
merged 1 commit into from
Jun 26, 2017
Merged

Conversation

stevej
Copy link
Contributor

@stevej stevej commented Jun 26, 2017

Problem:

  1. On -noreuse, we are not remembering to tear down connections.
  2. If the backend is hanging, we should ensure we exit after a timeout.

Solution:
Adds connect and request timeouts.
Forces the client to close if -noreuse is set.

Fixes #24.

Copy link
Member

@olix0r olix0r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! ⭐️

main.go Outdated
hashValue uint64,
checkHash bool,
hasher hash.Hash64,
received chan *MeasuredResponse,
bodyBuffer []byte,
) {
req, err := http.NewRequest(method, url.String(), bytes.NewBuffer(requestData))
if noreuse {
req.Close = true
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or just req.Close = noreuse

Problem:
1) On `-noreuse`, we are not remembering to tear down connections.
2) If the backend is hanging, we should ensure we exit after a timeout.

Solution:
Adds connect and request timeouts.
Forces the client to close if `-noreuse` is set.

Fixes #24.
@stevej stevej merged commit b449e3e into master Jun 26, 2017
@stevej stevej removed the reviewable label Jun 26, 2017
@stevej stevej deleted the stevej/issue_24 branch June 26, 2017 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set a timeout for http and https
2 participants