-
Notifications
You must be signed in to change notification settings - Fork 1.2k
basichost: move EvtLocalAddrsChanged to addrs_manager #3355
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
base: master
Are you sure you want to change the base?
Conversation
1b4f6c6
to
7ceafe9
Compare
91d3854
to
611df04
Compare
7ceafe9
to
b7f0784
Compare
611df04
to
8be2504
Compare
c0a8a78
to
cc0711a
Compare
b8d1eab
to
d388884
Compare
cc0711a
to
7a01719
Compare
d388884
to
4d77c2b
Compare
7a01719
to
771b390
Compare
4d77c2b
to
51add1c
Compare
771b390
to
6a09306
Compare
51add1c
to
2346193
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better if we did the following:
- Add a method to the Peerstore interface for
HandleLocalAddrUpdate(currentAddrs []multiaddr.Multiaddr, lastAddrs []multiaddr.Multiaddr) error
. - Have this method handle all the peerstore related code including the signed peer records.
- Move emitting here instead of basic host.
We'll deprecate this event, but we still have to keep sending this for a few more releases. More importantly, we need to update the peerstore with the host's addresses and it's better to do this *before* sending update events so that consumers of the event can rely on the host addrs being updated in the peerstore.
3846f17
to
f9389e0
Compare
I've made this change to adding a method on the peerstore. I'm not convinced about it though.
|
// This method should only be used to update the addresses of the Host that owns the peerstore. | ||
UpdateHostAddrs(hostID peer.ID, currentAddrs, removedAddrs, peerRecordAddrs []ma.Multiaddr) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping the signature this way to avoid attaching a peerstore to a host. That would complicate the host creation even more.
f9389e0
to
e675e47
Compare
@@ -98,6 +100,33 @@ func (ps *pstoremem) PeerInfo(p peer.ID) peer.AddrInfo { | |||
} | |||
} | |||
|
|||
func (ps *pstoremem) UpdateHostAddrs(hostID peer.ID, currentAddrs, removedAddrs, peerRecordAddrs []ma.Multiaddr) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a small change here. All host's now will store the signed peer record in th e peerstore. This I think is okay because identify is configured to disable sending signed peer records.
e675e47
to
ecab374
Compare
We'll deprecate this event, but we still have to keep sending this for a few more releases. More importantly, we need to update the peerstore with the host's addresses and it's better to do this before sending update events so that consumers of the event can rely on the host addrs being updated in the peerstore.