-
Notifications
You must be signed in to change notification settings - Fork 116
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
WIP: Deprecate SbSocket and migrate to socket APIs #2198
Conversation
Datadog ReportBranch report: ✅ 0 Failed, 6140 Passed, 1 Skipped, 1m 50.27s Wall Time |
@@ -105,11 +106,17 @@ bool Socket::IsPending() { | |||
} | |||
|
|||
SbSocketError Socket::GetLastError() { |
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.
Do we want to keep the return type of this to be SbSocketError in SB16+? Will we eventually stop using SbSocketError and move to int or no?
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 would say NO, not going to carry the SbSocketError to SB16+.
c881e8a
to
06ef809
Compare
SbSocketClearLastError -> errno SbSocketGetLastError -> errno Replace SbSocketPrivate by SbSocketWrapper (temporarily) SbSocketCreate -> socket b/302701164 Change-Id: Ie1c099743a8cec011c890c87cb0b23ec945ca1a0
06ef809
to
0bd00cb
Compare
@@ -126,6 +137,41 @@ typedef struct SbSocketResolution { | |||
// Well-defined value for an invalid socket handle. | |||
#define kSbSocketInvalid ((SbSocket)NULL) | |||
|
|||
#if SB_API_VERSION >= 16 |
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 code should go in starboard/common.
We don't allow c++ code in the starboard/foo.h headers.
#include "starboard/common/socket.h" | ||
#else | ||
#include <errno.h> |
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.
Please file a bug to make <errno.h> work!
socket_ = SbSocketCreate(ConvertAddressFamily(family), kSbSocketProtocolTcp); | ||
#else | ||
int socket_fd = socket(ConvertSocketAddressTypeToDomain(ConvertAddressFamily(family)), |
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.
Is this just temporary till you get all the APIs adjusted?
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.
Yes.
errno = save_errno; | ||
socket_ = kSbSocketInvalid; | ||
} else { | ||
socket_ = new SbSocketWrapper(ConvertAddressFamily(family), kSbSocketProtocolTcp, socket_fd); |
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.
Why do you need a SbSocketWrapper?
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.
Structure SbSocket members are associated to each other, like the address, the type, the error, and socket_waiter. It is convenient to keep them in a group.
@@ -314,6 +314,8 @@ ExportedSymbols::ExportedSymbols() { | |||
REGISTER_SYMBOL(SbStringFormat); | |||
REGISTER_SYMBOL(SbStringFormatWide); | |||
REGISTER_SYMBOL(SbStringScan); | |||
REGISTER_SYMBOL(SbSocketClearLastError); |
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.
Why are you introducing new Starboard symbols in SB 16?
REGISTER_SYMBOL(SbSocketConnect); | ||
#if SB_API_VERSION < 16 | ||
REGISTER_SYMBOL(SbSocketCreate); |
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.
Where is the posix socket
API registration?
SbSocketClearLastError -> errno
SbSocketGetLastError -> errno
b/302701164
Change-Id: Ie1c099743a8cec011c890c87cb0b23ec945ca1a0