Skip to content

quic: refactor QuicPersistentInfoImpl - #20051

Merged
RyanTheOptimist merged 52 commits into
envoyproxy:mainfrom
danzh2010:splitquicinfo
Feb 24, 2022
Merged

RyanTheOptimist merged 52 commits into
envoyproxy:mainfrom
danzh2010:splitquicinfo

Conversation

@danzh2010

@danzh2010 danzh2010 commented Feb 18, 2022 •

Copy link
Copy Markdown
Contributor

Commit Message: Refactor QuicPersistentInfoImpl. Move out the fields that are not persistent across cluster, i.e. transport_socket_factory_ and client_conext_, and crypto_config_.

This is to prepare for changing QuicPersistentInfoImpl ownership to cluster in #19862.

Risk Level: low, refactoring only
Testing: existing tests pass
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A
Part of #19861, #18715

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

Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only

Copy link
Copy Markdown

Retrying Azure Pipelines:
Check envoy-presubmit didn't fail.
Check envoy-presubmit didn't fail.

🐱

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

see: more, trace.

@danzh2010

Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only

Copy link
Copy Markdown

Retrying Azure Pipelines:
Check envoy-presubmit didn't fail.
Check envoy-presubmit didn't fail.

🐱

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

see: more, trace.

@danzh2010

Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only

Copy link
Copy Markdown

Retrying Azure Pipelines:
Check envoy-presubmit didn't fail.
Check envoy-presubmit didn't fail.

🐱

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

see: more, trace.

@danzh2010

Copy link
Copy Markdown
Contributor Author

@RyanTheOptimist This is good for review!

@RyanTheOptimist

Copy link
Copy Markdown
Contributor

Now that #19860 has been merged, can you update this PR to merge in main?

@danzh2010

Copy link
Copy Markdown
Contributor Author

Now that #19860 has been merged, can you update this PR to merge in main?

CI cleared. PTAL!

@RyanTheOptimist RyanTheOptimist left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for rebasing! So much easier to review. This looks good modulo just a few nits.

Comment thread source/common/http/http3/conn_pool.cc Outdated
getConfig(Network::TransportSocketFactory& transport_socket_factory) {
auto* quic_socket_factory =
dynamic_cast<Quic::QuicClientTransportSocketFactory*>(&transport_socket_factory);
ASSERT(quic_socket_factory != nullptr);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since transport_socket_factory is a reference, it's guaranteed to be non-null. How 'bout we stick with refs and do this:

return dynamic_cast<Quic::QuicClientTransportSocketFactory&>(transport_socket_factory).clientContextConfig();

This avoids the local variable and the ASSERT().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done


// Returns the most recent crypto config from transport_socket_factory_;
std::shared_ptr<quic::QuicCryptoClientConfig> cryptoConfig();
PersistentQuicInfoImpl(Event::Dispatcher& dispatcher, uint32_t buffer_limit);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: as long as you're here, would you mind commenting on what |buffer_limit| applies to? (Is it a per stream or per session flow control limit?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's the connection send buffer (soft) limit. I modified the comment about buffer_limit_ member variable to be more specific.

Comment thread source/common/http/http3/conn_pool.cc Outdated

std::shared_ptr<quic::QuicCryptoClientConfig> Http3ConnPoolImpl::cryptoConfig() {
auto* quic_socket_factory =
dynamic_cast<Quic::QuicClientTransportSocketFactory*>(&host_->transportSocketFactory());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: if we cast to Quic::QuicClientTransportSocketFactory& I think we can avoid the null check and local variable

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread source/common/http/http3/conn_pool.cc Outdated
auto* quic_socket_factory =
dynamic_cast<Quic::QuicClientTransportSocketFactory*>(&host_->transportSocketFactory());
ASSERT(quic_socket_factory != nullptr);
auto context = quic_socket_factory->sslCtx();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: I think the style guide would recommend using the explicit type name here.

The fundamental rule is: use type deduction only to make the code clearer or safer, and do not use it merely to avoid the inconvenience of writing an explicit type. When judging whether the code is clearer, keep in mind that your readers are not necessarily on your team, or familiar with your project, so types that you and your reviewer experience as unnecessary clutter will very often provide useful information to others. For example, you can assume that the return type of make_unique() is obvious, but the return type of MyWidgetFactory() probably isn't.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

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

Copy link
Copy Markdown
Contributor Author

@RyanTheOptimist can this be merged?

@RyanTheOptimist
RyanTheOptimist merged commit dd141e1 into envoyproxy:main Feb 24, 2022
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.

3 participants