quiche: more platform implementations and enhancement#7283
quiche: more platform implementations and enhancement#7283mattklein123 merged 20 commits intoenvoyproxy:masterfrom
Conversation
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
|
/assign @wu-bin @mattklein123 |
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
|
/retest |
|
🔨 rebuilding |
|
|
||
| envoy_cc_library( | ||
| name = "quic_core_alarm_lib", | ||
| name = "quic_core_alarm_interface", |
There was a problem hiding this comment.
Why rename these quic core libraries? We've discussed this before and agreed to mirror the internal libraries names.
There was a problem hiding this comment.
This is envoy convention. For interface libraries, use suffix _interface instead of _lib. This is clearer than internal libraries names.
There was a problem hiding this comment.
This is a quic core library, the code does not use envoy convention, the build rule also doesn't have to. (recall that we want to export the build rules in quiche and use it from envoy some day)
That said, in this case we can use envoy convention and the same name at the same time, just rename the internal library to _interface.
bazel/external/quiche.BUILD
Outdated
| ) | ||
|
|
||
| envoy_cc_library( | ||
| name = "quic_platform_logging", |
There was a problem hiding this comment.
Why put logging into a separate library? As we discussed before, we should avoid adding standalone platform libraries unless necessary.
There was a problem hiding this comment.
I put it outside of quic_platform_base so that quic_socket_address.h can be placed in quic_platform_base. So other core libraries don't have to explicitly depend on quic_platform_socket_address. Becaue quic_platform_ip_address depends on it, and quic_socket_address depends on quic_platform_ip_address.
But considering that quic_socket_address will be moved to core eventually, I think it makes much more sends to make these 2 network address libraries stand-alone and keep logging as part of quic_platform_base.
| ) | ||
|
|
||
| envoy_cc_library( | ||
| name = "quic_platform_ip_address", |
There was a problem hiding this comment.
It's ok to keep this as a standalone library because it will be moved to quic core soon.
| QuicLogSink* SetLogSink(QuicLogSink* new_sink); | ||
|
|
||
| // Overload std::operator<< to output a vector. | ||
| template <class T> std::ostream& operator<<(std::ostream& out, const std::vector<T>& v) { |
There was a problem hiding this comment.
This function is not specific to QUIC, can you move it to a better place?
There was a problem hiding this comment.
Only quic use this type of logging right? Envoy has it's only logging macros.
There was a problem hiding this comment.
It doesn't need to be used by the QUIC_LOG macros. It can also be used in unit tests to pretty-print the content of a vector, similar to
There was a problem hiding this comment.
I'm not sure where is the best place for such overload. This seems very much like an overload only for tests, but we definitely don't want to place it under /test.
There was a problem hiding this comment.
source/common/common/stl_helpers.h sounds like a fine place for this.
| template <class T> std::ostream& operator<<(std::ostream& out, const std::vector<T>& v) { | ||
| out << "vector { "; | ||
| size_t i = 0; | ||
| for (; i < v.size() - 1; ++i) { |
There was a problem hiding this comment.
I think line 186-193 can be replaced by absl::StrJoin(v, ", ", absl::StreamFormatter()).
|
|
||
| TEST_F(QuicPlatformTest, QuicLogVector) { | ||
| std::vector<int32_t> v = {1, 2, 3, 4, 5}; | ||
| EXPECT_LOG_CONTAINS("info", "vector { 1, 2, 3, 4, 5 }", QUIC_LOG(INFO) << v); |
There was a problem hiding this comment.
Does it work? IIRC, the default log level is ERROR, and INFO will not be logged unless you do GetLogger().set_level(INFO)
There was a problem hiding this comment.
It shouldn't. But it did pass. It seems to be a bug in quic logging implementation. Anyway, the purpose of this test is testing operator<< overload, not logging level. I changed it to output at error instead.
There was a problem hiding this comment.
It works because the macro forcefully set the log level to "trace".
Signed-off-by: Dan Zhang <danzh@google.com>
|
/retest |
|
🐴 hold your horses - no failures detected, yet. |
|
/retest |
|
🐴 hold your horses - no failures detected, yet. |
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
|
/retest |
|
🤷♀️ nothing to rebuild. |
|
Please merge master to fix CI. /wait |
|
/retest |
|
🤷♀️ nothing to rebuild. |
Signed-off-by: Dan Zhang <danzh@google.com>
|
|
||
| // NOLINT(namespace-envoy) | ||
| // Overload functions in std library. | ||
| namespace std { |
There was a problem hiding this comment.
Can we put it into the global namespace? I think it can be used everywhere that way.
There was a problem hiding this comment.
in std namespace can also be used everywhere, at least in Envoy and quic namespaces as tested.
Similar overloads are all in std namespace in envoy. I just follow the convention.
| @@ -10,7 +10,7 @@ | |||
|
|
|||
There was a problem hiding this comment.
Since QuicSocketAddress has been de-platformized, can we delete this file now?
There was a problem hiding this comment.
QuicSocketAddress has not been de-platformized in this tar ball yet. I still has problem to roll the tar ball upto where it is de-platformized, waiting for upstream fix to be merged into quiche. But quic_ip_address_impl.h should.
Signed-off-by: Dan Zhang <danzh@google.com>
mattklein123
left a comment
There was a problem hiding this comment.
LGTM @wu-bin any further comments?
Roll up quiche tar ball to 88e3e05c341147f4052e17a2769ac2722739c498.
Add more platform implementations: quic_optional_impl, quic_macros_impl, quic_error_code_wrappers_imp.
Enhance quic_client_stats_impl and quic_mem_slice_span_impl with more functionalities or make them more robust.
Add an overload function of std::operator<< to streaming out a std::vector.
Risk Level: low, not in use
Testing: Added tests for newly added impl's and functionality.
Part of #2557