-
Notifications
You must be signed in to change notification settings - Fork 5.5k
IoHandle readv and writev #6037
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
Changes from 15 commits
5ef14db
ac33143
91d8724
c1cdc6a
db7f0b8
1013570
f67a6d5
64d846c
e7d9dd0
dae1a6c
a2598b9
f4ca5b7
4093649
90700d6
a398154
774dc4c
cb062a9
aa79e43
d4fa86d
6306999
66580ae
d6bf143
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #include "common/network/io_socket_error_impl.h" | ||
|
|
||
| #include "common/common/assert.h" | ||
|
|
||
| namespace Envoy { | ||
| namespace Network { | ||
|
|
||
| Api::IoError::IoErrorCode IoSocketError::getErrorCode() const { | ||
| switch (errno_) { | ||
| case EAGAIN: | ||
| RELEASE_ASSERT(this == getIoSocketEagainInstance(), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be an ASSERT right?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the diff between ASSERT and RELEASE_ASSERT?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. RELEASE_ASSERT is enabled in all builds, ASSERT is for fastbuild/dbg builds only.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 for normal ASSERT
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. |
||
| "Didn't use IoSocketEagain to represent EAGAIN."); | ||
| return IoErrorCode::Again; | ||
| case EBADF: | ||
| return IoErrorCode::BadHandle; | ||
| case ENOTSUP: | ||
| return IoErrorCode::NoSupport; | ||
| case EAFNOSUPPORT: | ||
| return IoErrorCode::AddressFamilyNoSupport; | ||
| case EINPROGRESS: | ||
| return IoErrorCode::InProgress; | ||
| case EPERM: | ||
| return IoErrorCode::Permission; | ||
| default: | ||
| return IoErrorCode::UnknownError; | ||
| } | ||
| } | ||
|
|
||
| std::string IoSocketError::getErrorDetails() const { return ::strerror(errno_); } | ||
|
|
||
| } // namespace Network | ||
| } // namespace Envoy | ||
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.
given this interface can you add method:
I had to also read below at usages to understand that rc is really the interface-dependent return value. Can you call it return_value_ instead of rc_ (which sounds like it might be errno or something), and use ReturnValue rather than T as your template param?
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.
and of course use that method at call-sites rather than directly dereferencing err_.
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.
This renaming will touch even larger scope of files which is not related to socket read/write, since IoError is used in filesystem now. I would prefer do it separately so that this PR doesn't looks confusing.
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.
Can we add the ok() method now and change usage in files already in this PR, and follow up with the file-system changes later?
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.
Adding ok() sounds good to me
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.
done