Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Fix use of "break" within "select" in LocalConnection actorLoop #731

Merged
merged 1 commit into from
May 22, 2015

Conversation

dpw
Copy link
Contributor

@dpw dpw commented May 22, 2015

From the golang spec: 'A "break" statement terminates execution of the
innermost "for", "switch", or "select" statement within the same
function.' But the LocalConnection actorLoop seems to assume it
skips the "select" and terminates the enclosing "for".

As a result, if something did conn.Shutdown(nil), it would not actually
shutdown the connection. It turns out this is never a problem, because
Shutdown is always called with a non-nil error, even though there is code
in a few places to handle the nil case. By cleaning that up, the dubious
"break" is eliminated.

From the golang spec: 'A "break" statement terminates execution of the
innermost "for", "switch", or "select" statement within the same
function.'  But the LocalConnection actorLoop seems to assume it
skips the "select" and terminates the enclosing "for".

As a result, if something did conn.Shutdown(nil), it would not actually
shutdown the connection. It turns out this is never a problem, because
Shutdown is always called with a non-nil error, even though there is code
in a few places to handle the nil case. By cleaning that up, the dubious
"break" is eliminated.
@rade rade added this to the 0.11.0 milestone May 22, 2015
rade added a commit that referenced this pull request May 22, 2015
Fix use of "break" within "select" in LocalConnection actorLoop
@rade rade merged commit b20b4a8 into weaveworks:master May 22, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants