Skip to content

fix: fix connection gater in transport constructor#948

Merged
Stebalien merged 1 commit intomasterfrom
fix/ctor
May 20, 2020
Merged

fix: fix connection gater in transport constructor#948
Stebalien merged 1 commit intomasterfrom
fix/ctor

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!

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