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: fix connection gater in transport constructor #948

Merged
merged 1 commit into from
May 20, 2020
Merged

Conversation

Stebalien
Copy link
Member

No description provided.

@Stebalien Stebalien requested a review from raulk May 20, 2020 18:09
Copy link
Member

@raulk raulk left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this!

@@ -28,12 +28,12 @@ var (
privKeyType = reflect.TypeOf((*crypto.PrivKey)(nil)).Elem()
pubKeyType = reflect.TypeOf((*crypto.PubKey)(nil)).Elem()
pstoreType = reflect.TypeOf((*peerstore.Peerstore)(nil)).Elem()
connGaterType = reflect.TypeOf((*connmgr.ConnectionGater)(nil)).Elem()
Copy link
Member

Choose a reason for hiding this comment

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

Note for myself.

The type you really want is:

connGaterType = reflect.TypeOf((connmgr.ConnectionGater)(nil))  // dropping the pointer star

but you can’t do that because it’s syntactically illegal (can’t cast to an interface). So you create a pointer to the interface and then take the Elem() of the pointer value.

@Stebalien Stebalien merged commit b396e69 into master May 20, 2020
@Stebalien Stebalien mentioned this pull request May 26, 2020
77 tasks
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