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

Fix infinite server attempt to connect route to itself #202

Merged
merged 1 commit into from
Feb 11, 2016

Conversation

kozlovic
Copy link
Member

Attempt to address issue #175.
Instead of trying to detect if route URL will point to route listen address, detects that the route remoteID is server's ID. If so, closes the connection and stop trying.

Attempt to address issue #175.
Instead of trying to detect if route URL will point to route listen address, detects that the route remoteID is server's ID.
If so, closes the connection and stop trying.
@kozlovic
Copy link
Member Author

Chose this approach versus detection before even attempting to connect because of potential difficulties to accurately detect that the route's url is going to connect to the server's route listen port. For instance, the server could listen to "0.0.0.0:5222" and the route url be "192.168.1.1:5222". This would create a cycle and may not be that easy to detect before hand. Also, there were some other issues specific to the server running with docker.

@kozlovic
Copy link
Member Author

Note about code coverage reduction: it seems that we don't include all packages during the test. For instance, new code added in route.go, which is package server. The test testing this feature is in test/routes_test.go, which is package test. So the result in coveralls look like the code is not tested, while it is. Running this command shows that the code is executed as expected: go test -v -covermode=atomic -coverprofile=acc.out -coverpkg=github.com/nats-io/gnatsd/server -run=TestRouteToSelf ./test/

derekcollison added a commit that referenced this pull request Feb 11, 2016
Fix infinite server attempt to connect route to itself
@derekcollison derekcollison merged commit 50988b7 into master Feb 11, 2016
@derekcollison derekcollison deleted the detect_route_to_self branch February 11, 2016 06:37
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.

2 participants