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

Add keep-alive and timeout options (thanks @rexxar) #125

Merged
merged 3 commits into from
Feb 17, 2015

Conversation

jcrugzz
Copy link
Contributor

@jcrugzz jcrugzz commented Jan 7, 2015

When implementing keep-alive support I just pulled in the work from @Rexxar on timeouts as i slightly refactored it to handle timeout events that could possibly happen after connect (which I have not seen but was going for the side of safety). @squaremo let me know your thoughts as I think having keep-alive support is a nice complement to the heartbeat functionality you have implemented.

@jcrugzz
Copy link
Contributor Author

jcrugzz commented Jan 7, 2015

hmm its curious that 0.8.x fails here, looking into that.

@@ -101,6 +101,11 @@ function connect(url, socketOptions, openCallback) {
var parts = URL.parse(url, true); // yes, parse the query string
var protocol = parts.protocol;
var noDelay = !!sockopts.noDelay;
// We should default to true as this nicely complements the heartbeat
var keepAlive = !!sockopts.keepAlive || true;
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't actually do what you want... If I specify { keepAlive: false }, this will basically say var keepAlive = false || true;, which obviously is always true. So you're basically always enabling keepAlive here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah good catch, thanks!

@squaremo
Copy link
Collaborator

To be honest I'm not sure if using TCP keep-alive is appropriate here or not. It might be a better way (than using AMQP's heartbeats) of keeping load-balanced and NAT connections open. Is that the idea, @jcrugzz ?

@jcrugzz
Copy link
Contributor Author

jcrugzz commented Jan 21, 2015

@squaremo the idea was to just be complementary to the heartbeats as they are both designed to keep the TCP socket open and detect when something has been broken.

@squaremo squaremo merged commit dbefbaa into amqp-node:master Feb 17, 2015
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.

None yet

3 participants