Skip to content

listener: ListenConfig::listenSocketFactory - #8976

Merged
mattklein123 merged 17 commits into
envoyproxy:masterfrom
danzh2010:socketfactory
Nov 13, 2019
Merged

mattklein123 merged 17 commits into
envoyproxy:masterfrom
danzh2010:socketfactory

Conversation

@danzh2010

Copy link
Copy Markdown
Contributor

Add ListenSocketFactory interface. Replace ListenConfig::socket() interface with listenSocketFactory() to prepare for SO_REUSEPORT.

The old TcpListenSocket creation is changed to creating a TcpListenSocketFactory which creates a TCP socket during construction in addOrUpdateListener(). This socket factory always provides the same socket when ListenSocketFactory::createListenSocket() is called.

The old UdpListenSocket create is changed to creating a UdpListenSocketFactory in addOrUpdateListener() without creating a UDP socket. The socket will be created when actual UdpListener is created in each worker thread. As currently, we don't support SO_REUSEPORT on UDP socket, createListenSocket() can only be called once.

Risk Level: low, mainly code refactoring, no change to TCP socket creation time.
Testing: existing tests

Part of #8794, #2557

@danzh2010

Copy link
Copy Markdown
Contributor Author

/assign @mattklein123 @l8huang

@repokitteh-read-only

Copy link
Copy Markdown

@l8huang cannot be assigned to this issue.

🐱

Caused by: a #8976 (comment) was created by @danzh2010.

see: more, trace.

@danzh2010

Copy link
Copy Markdown
Contributor Author

/assign @mattklein123

@danzh2010

Copy link
Copy Markdown
Contributor Author

/assign @l8huang

@repokitteh-read-only

Copy link
Copy Markdown

@l8huang cannot be assigned to this issue.

🐱

Caused by: a #8976 (comment) was created by @danzh2010.

see: more, trace.

Signed-off-by: Dan Zhang <[email protected]>
Signed-off-by: Dan Zhang <[email protected]>
@mattklein123

Copy link
Copy Markdown
Member

@danzh2010 needs a master merge after my UDP proxy PR. Can you merge master and then I will take a look?

/wait

@danzh2010

Copy link
Copy Markdown
Contributor Author

@danzh2010 needs a master merge after my UDP proxy PR. Can you merge master and then I will take a look?

/wait

done. PTAL!

@mattklein123 mattklein123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general this looks great. Flushing out a bunch of random small comments. Thank you!

/wait

Comment thread include/envoy/network/listener.h Resolved
Comment thread source/server/http/admin.h Resolved
Comment thread source/server/listener_impl.cc Resolved
Comment thread source/server/hot_restarting_parent.cc Resolved
Comment thread source/server/listener_impl.cc Resolved
Comment thread source/server/listener_impl.cc Resolved
Comment thread source/server/listener_impl.h Resolved
Comment thread source/server/listener_impl.h Resolved
Comment thread source/server/listener_manager_impl.cc Resolved
Signed-off-by: Dan Zhang <[email protected]>

@mattklein123 mattklein123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, nice work. LGTM with some small comments. cc @euroelessar if you have time to take a quick look.

/wait

Comment thread source/server/http/admin.h Resolved
Comment thread source/server/listener_impl.cc Resolved
Comment thread source/server/listener_impl.h Resolved
Comment thread source/server/listener_manager_impl.cc Resolved
Signed-off-by: Dan Zhang <[email protected]>
Comment thread source/common/event/dispatcher_impl.cc Resolved
Comment thread source/common/network/listener_impl.cc Resolved
Comment thread source/server/http/admin.h Resolved
Comment thread source/server/listener_impl.cc Resolved
Comment thread source/server/listener_impl.h Resolved

@mattklein123 mattklein123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo a few small nits and sorting out @l8huang's remaining comments.

/wait

Comment thread include/envoy/network/listener.h Resolved
Comment thread source/server/listener_impl.h Resolved
Comment thread source/server/listener_manager_impl.cc Resolved
Signed-off-by: Dan Zhang <[email protected]>
Signed-off-by: Dan Zhang <[email protected]>

@mattklein123 mattklein123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

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.

5 participants