-
Notifications
You must be signed in to change notification settings - Fork 5.3k
listener: fix sharedSocket #17090
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
Merged
Merged
listener: fix sharedSocket #17090
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
759a38b
fix prod
lambdai f142345
fix test
lambdai f55e317
format
lambdai a12492f
add extra io handle check
lambdai 06d434b
Merge remote-tracking branch 'origin/main' into tcpbindtoport
lambdai 14b244a
Merge branch 'main' into tcpbindtoport
lambdai 34e6c6f
unify udp and tcp listener socket constructor
lambdai df2d945
clean up
lambdai 60cdee7
update comment
lambdai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,9 +75,6 @@ class ActiveQuicListenerFactoryPeer { | |
|
|
||
| class ActiveQuicListenerTest : public QuicMultiVersionTest { | ||
| protected: | ||
| using Socket = | ||
| Network::NetworkListenSocket<Network::NetworkSocketTrait<Network::Socket::Type::Datagram>>; | ||
|
|
||
| ActiveQuicListenerTest() | ||
| : version_(GetParam().first), api_(Api::createApiForTest(simulated_time_system_)), | ||
| dispatcher_(api_->allocateDispatcher("test_thread")), clock_(*dispatcher_), | ||
|
|
@@ -208,7 +205,8 @@ class ActiveQuicListenerTest : public QuicMultiVersionTest { | |
| } | ||
|
|
||
| void sendCHLO(quic::QuicConnectionId connection_id) { | ||
| client_sockets_.push_back(std::make_unique<Socket>(local_address_, nullptr, /*bind*/ false)); | ||
| client_sockets_.push_back(std::make_unique<Network::SocketImpl>(Network::Socket::Type::Datagram, | ||
|
Comment on lines
211
to
+208
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mattklein123 With this change, the io_handle == nullptr iff bind_to_port for listensocket, both tcp and udp. Now UDP and TCP listener behavior is now unified including what you pointed out |
||
| local_address_, nullptr)); | ||
| Buffer::OwnedImpl payload = generateChloPacketToSend( | ||
| quic_version_, quic_config_, ActiveQuicListenerPeer::cryptoConfig(*quic_listener_), | ||
| connection_id, clock_, envoyIpAddressToQuicSocketAddress(local_address_->ip()), | ||
|
|
@@ -317,7 +315,7 @@ class ActiveQuicListenerTest : public QuicMultiVersionTest { | |
| Init::MockManager init_manager_; | ||
| NiceMock<ProtobufMessage::MockValidationVisitor> validation_visitor_; | ||
|
|
||
| std::list<std::unique_ptr<Socket>> client_sockets_; | ||
| std::list<std::unique_ptr<Network::SocketImpl>> client_sockets_; | ||
| std::list<std::shared_ptr<Network::MockReadFilter>> read_filters_; | ||
| Network::MockFilterChainManager filter_chain_manager_; | ||
| // The following two containers must guarantee pointer stability as addresses | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
In working through my other change, I'm hitting a similar issue on
setSocketOption(now that reuse port is the default). I think there is a similar bug there also. It makes me think we are going about the no bind sockets incorrectly in general if we need all these guards.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.e. why do no bind listeners even have sockets. I realize this is a much larger change and I'm trying to get through my current mess first, but this seems like something we might want to fix in the future.)
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.
SetSocketOption should check bind_to_port w/ or w/o PR. At least ListenSocketImpl::setupSocket has a bind_to_port arg.
Good point! I was thinking about create a derived not-bind-listen-socket and you think deeper