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

portPicker function now takes group name #70

Merged
merged 1 commit into from Aug 3, 2016
Merged

portPicker function now takes group name #70

merged 1 commit into from Aug 3, 2016

Conversation

mdentonSkyport
Copy link
Contributor

With RegisterPerGroupPeerPicker added to register a function of this type. Useful for choosing a PeerPicker based on the group.

// called exactly once, but not both.
func RegisterPerGroupPeerPicker(fn func(groupName string) PeerPicker) {
if portPicker != nil {
panic("RegisterPeerPicker called more than once")

Choose a reason for hiding this comment

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

Misleading panic text. It implies that just RegisterPeerPicker called more that once, while in reality it was RegisterPerGroupPeerPicker called twtice or both RegisterPeerPicker & RegisterPerGroupPeerPicker called. It can be even worse inside the RegisterPeerPicker() - people will try to search for duplicate RegisterPeerPicker() calls while it was RegisterPeerPicker() + RegisterPerGroupPeerPicker().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'll address this in the next PR.

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.

3 participants