-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Adds block property to socket io results #13409
Conversation
Signed-off-by: sotiris Nanopoulos <sonanopo@microsoft.com>
Why this change?The way we plan to use this functionality is the following: We want in Note on the implementation@antoniovicente I know that we discussed adding this functionality to This makes it hard when we call cc @envoyproxy/windows-dev |
Signed-off-by: sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: sotiris Nanopoulos <sonanopo@microsoft.com>
source/extensions/transport_sockets/proxy_protocol/proxy_protocol.cc
Outdated
Show resolved
Hide resolved
Do we have a test for the would_block status flag? Something analogous to TEST_P(UdpListenerImplTest, SendDataError) where we request IO, the underlying syscall returns EWOULDBLOCK, and we verify that the IoResult has the would_block flag set. |
Agreed will add some tests to verify the property added. Let me see all the cascading changes in all the socket types and I will add a test for each socket that I have changed |
Signed-off-by: sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: sotiris Nanopoulos <sonanopo@microsoft.com>
/** | ||
* True if the I/O call would block. | ||
*/ | ||
bool would_block; |
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.
Would the convention be would_block_?
@@ -16,6 +16,7 @@ void RawBufferSocket::setTransportSocketCallbacks(TransportSocketCallbacks& call | |||
IoResult RawBufferSocket::doRead(Buffer::Instance& buffer) { | |||
PostIoAction action = PostIoAction::KeepOpen; | |||
uint64_t bytes_read = 0; | |||
bool wouldBlock = false; |
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.
Would the convention be would_block?
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.
ack, I think you are right again 😄
@@ -38,18 +39,20 @@ IoResult RawBufferSocket::doRead(Buffer::Instance& buffer) { | |||
ENVOY_CONN_LOG(trace, "read error: {}", callbacks_->connection(), | |||
result.err_->getErrorDetails()); | |||
if (result.err_->getErrorCode() != Api::IoError::IoErrorCode::Again) { | |||
wouldBlock = true; |
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 think this is still wrong. Shouldn't we set would_block to true if (result.err_->getErrorCode() == Api::IoError::IoErrorCode::Again)
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 am trying to set up tests for all the sockets so we can make sure that we got all of them correctly
Based on the discussion on slack channel https://envoyproxy.slack.com/archives/C78HA81DH/p1602261758081000 Closing in favour of #13478 |
Signed-off-by: Sotiris Nanopoulos sonanopo@microsoft.com
In preparation for #13189 we add the following functionality to the internal API:
getEnabled
tofile_event.h
which returns the active events in a file event. This is useful todidBlock
toIoResult
to know if the last I/O call blocked.Risk Level: Low
Testing: Tests
Docs Changes: N/A
Release Notes: N/A