-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Make 'BasicHost.emitters.evtLocalAddrsUpdated' stateful. #1145
Comments
No, that seems quite reasonable. At the moment, the best approach is to:
1. Subscribe.
2. Get the current addresses.
But I agree making this stateful would simplify things. Want to make a patch?
|
Perfect! I'll have a patch ready shortly. |
@Stebalien See #1147. Do you think it's worth making |
Not really. The addresses one makes sense (somewhat) because it has includes all addresses. The protocols one is just for protocol updates. I say somewhat for the addresses one because ideally it wouldn't return "removed" addresses in the first event. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
Currently, subscribing to
event.EvtLocalAddrsUpdated
is not stateful, meaning that subscribers will miss the initial set of addresses emitted during host initialization.While not a huge deal (we can just call
h.Addrs()
), this requires additional initialization outside of the subscription logic. This is kind of annoying; I would much prefer to write:Currently, I have to write something akin to
setup(h.Addrs())
somewhere else.Solution
The solution is to pass
eventbus.Stateful
to the emitter's constructor, here.Is this doable, or will it break something? I'm happy to submit a PR if this is pre-approved in principle.
The text was updated successfully, but these errors were encountered: