Repository navigation
quic: Fix QuicFilterManagerConnectionImpl::ConnectionInfoProviderSharedPtr - #19008
RyanTheOptimist merged 9 commits into
Conversation
|
/assign @danzh2010 |
…edPtr If QuicFilterManagerConnectionImpl::ConnectionInfoProviderSharedPtr is called after the connection is closed, return nullptr. Signed-off-by: Ryan Hamilton <[email protected]>
Signed-off-by: Ryan Hamilton <[email protected]>
62b824b to
60919fc
Compare
Signed-off-by: Ryan Hamilton <[email protected]>
Signed-off-by: Ryan Hamilton <[email protected]>
Signed-off-by: Ryan Hamilton <[email protected]>
| @@ -64,6 +64,9 @@ class QuicFilterManagerConnectionImpl : public Network::ConnectionImplBase, | |||
| return network_connection_->connectionSocket()->connectionInfoProvider(); | |||
There was a problem hiding this comment.
Does this one need the same fix as well?
There was a problem hiding this comment.
I don't think this one is fixable, at least not without a larger refactor of this class (which maybe we should do?). This method returns a reference to a ConnectionInfoSetter. But if the network_connection_ or the network_connection_->connectionSocket() are null then this method will return a null reference (which is illegal). So presumably this method must only be called when they are non-null? If that is not a valid assumption then perhaps we need to refactor this class to make this information always available?
There was a problem hiding this comment.
Good point! Can you add ENVOY_BUG before returning?
| return network_connection_->connectionSocket()->connectionInfoProvider(); | ||
| } | ||
| Network::ConnectionInfoProviderSharedPtr connectionInfoProviderSharedPtr() const override { | ||
| if (!network_connection_ || !network_connection_->connectionSocket()) { |
There was a problem hiding this comment.
Does this break existing tests?
There was a problem hiding this comment.
I hope not :) If either of those are null when this method is called, we would see a crash in the old code. With the new code, we don't crash, we just return null. CI is green, so I think we're ok.
Signed-off-by: Ryan Hamilton <[email protected]>
Signed-off-by: Ryan Hamilton <[email protected]>
danzh2010
left a comment
There was a problem hiding this comment.
Thanks for fixing this!
|
/assign @alyssawilk |
|
/retest |
|
Retrying Azure Pipelines: |
| } | ||
| }; | ||
|
|
||
| TEST(QuicFilterManagerConnectionImplTest, ConnectionInfoProviderSharedPtr) { |
There was a problem hiding this comment.
Optional, do you think we should make this all a test fixture, for ease of future tests?
There was a problem hiding this comment.
Heh, I did consider it initially and wasn't sure if it'd be worth doing. But if it also occurred to you then I'm sure it is. Done!
Signed-off-by: Ryan Hamilton <[email protected]>
Signed-off-by: Ryan Hamilton <[email protected]>
a08314b
| } | ||
| }; | ||
|
|
||
| TEST(QuicFilterManagerConnectionImplTest, ConnectionInfoProviderSharedPtr) { |
There was a problem hiding this comment.
Heh, I did consider it initially and wasn't sure if it'd be worth doing. But if it also occurred to you then I'm sure it is. Done!
quic: Fix QuicFilterManagerConnectionImpl::ConnectionInfoProviderSharedPtr
If QuicFilterManagerConnectionImpl::ConnectionInfoProviderSharedPtr is
called after the connection is closed, return nullptr.
Risk Level: Low
Testing: New unit tests
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A