Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
udp_listener: refactor ActiveUdpListener creation #7884
udp_listener: refactor ActiveUdpListener creation #7884
Changes from 20 commits
6afe56a
2239c8c
fae6dfd
750b66a
00bcedd
0135b13
c1acee6
38d134f
4073c3d
fe4d6ed
0b8e3be
d7ecaa1
a671885
bd92a03
2e98344
1b106de
80b0cbb
68e52e1
e9e0141
7589802
1bacc51
c799d70
699583d
02c116c
2e10b24
c882315
ebf5b51
070da9c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
nit: I would return a raw pointer here vs. a reference to the smart_ptr, or better an optional reference wrapper if it can be null.
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.
Actually the caller will call reset() on it...
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.
nit: I think it would be better to provide an explicit shutdown(), destroy(), close(), etc. method would be clearer from an interface perspective.
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.
wrapping all the interfaces in Network::Listener doesn't help with unique_ptr::reset(). This interface allows underlying Listener object to be destroyed anytime.
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'm not sure I follow. Can't you just have an extra method on this interface called
close()
ordestroy()
or something? Exposing the unique ptr so that the caller can call reset on it seems pretty strange? I think the intent is to just destroy it?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'm not sure I if understand the intention of reset(), but I think we want to destroy the listener but keep the entry in the container? We could expose close() and destroy() and hide listner(), but how to handle reset() call then?
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 don't follow? Is the only purpose of exposing the listener pointer so that it can be reset/deleted? If so yeah can we just swap it with a close/destroy function?
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.
ah, I see what you mean. Yes,
listener().reset()
can be wrapped in a new interfacedestroy()
. However, ConnectionHandlerImpl::findListenerByAddress() expects to return a Listener&, which returns ActiveListener::listener() directly.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.
Right what I'm saying is to have 2 methods, 1 to return the listener which is an optional reference wrapper, and an explicit destroy method. I think that will be much more clear. Thank you!
/wait
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.
Got it. I make ActiveListener to inherit from Listener and added destroy() to it. And I also changed listener() to return a pointer to have less change to conn_handler_impl