Skip to content
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

Clean up socket.h header #4174

Merged
merged 3 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions net/base/net_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,6 @@ NET_EXPORT bool IsRequestBlockedError(int error);
NET_EXPORT Error MapSystemError(logging::SystemErrorCode os_error);

#if defined(STARBOARD)
// Map socket error code to Error.
NET_EXPORT Error MapSocketError(SbSocketError error);

// Gets the last socket error as a net error.
static inline Error MapLastSocketError(SbSocket socket) {
return MapSocketError(SbSocketGetLastError(socket));
}

// Gets the last system error as a net error.
static inline Error MapLastSystemError() {
return MapSystemError(SbSystemGetLastError());
Expand Down
3 changes: 0 additions & 3 deletions starboard/android/shared/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,14 @@ static_library("starboard_platform") {
"//starboard/shared/posix/set_non_blocking_internal.cc",
"//starboard/shared/posix/socket_accept.cc",
"//starboard/shared/posix/socket_bind.cc",
"//starboard/shared/posix/socket_clear_last_error.cc",
"//starboard/shared/posix/socket_connect.cc",
"//starboard/shared/posix/socket_create.cc",
"//starboard/shared/posix/socket_destroy.cc",
"//starboard/shared/posix/socket_get_last_error.cc",
"//starboard/shared/posix/socket_get_local_address.cc",
"//starboard/shared/posix/socket_internal.cc",
"//starboard/shared/posix/socket_is_ipv6_supported.cc",
"//starboard/shared/posix/socket_listen.cc",
"//starboard/shared/posix/socket_receive_from.cc",
"//starboard/shared/posix/socket_send_to.cc",
"//starboard/shared/posix/socket_set_reuse_address.cc",
"//starboard/shared/posix/storage_write_record.cc",
"//starboard/shared/posix/system_break_into_debugger.cc",
Expand Down
18 changes: 0 additions & 18 deletions starboard/common/socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,30 +92,12 @@ Socket* Socket::Accept() {
return NULL;
}

bool Socket::IsPending() {
return GetLastError() == kSbSocketPending;
}

SbSocketError Socket::GetLastError() {
return SbSocketGetLastError(socket_);
}

void Socket::ClearLastError() {
SbSocketClearLastError(socket_);
}

int Socket::ReceiveFrom(char* out_data,
int data_size,
SbSocketAddress* out_source) {
return SbSocketReceiveFrom(socket_, out_data, data_size, out_source);
}

int Socket::SendTo(const char* data,
int data_size,
const SbSocketAddress* destination) {
return SbSocketSendTo(socket_, data, data_size, destination);
}

bool Socket::GetLocalAddress(SbSocketAddress* out_address) {
return SbSocketGetLocalAddress(socket_, out_address);
}
Expand Down
3 changes: 0 additions & 3 deletions starboard/elf_loader/exported_symbols.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,14 @@ ExportedSymbols::ExportedSymbols() {
REGISTER_SYMBOL(SbPlayerWriteSamples);
REGISTER_SYMBOL(SbSocketAccept);
REGISTER_SYMBOL(SbSocketBind);
REGISTER_SYMBOL(SbSocketClearLastError);
REGISTER_SYMBOL(SbSocketConnect);
REGISTER_SYMBOL(SbSocketCreate);
REGISTER_SYMBOL(SbSocketDestroy);
REGISTER_SYMBOL(SbSocketGetInterfaceAddress);
REGISTER_SYMBOL(SbSocketGetLastError);
REGISTER_SYMBOL(SbSocketGetLocalAddress);
REGISTER_SYMBOL(SbSocketIsIpv6Supported);
REGISTER_SYMBOL(SbSocketListen);
REGISTER_SYMBOL(SbSocketReceiveFrom);
REGISTER_SYMBOL(SbSocketSendTo);
REGISTER_SYMBOL(SbSocketSetReuseAddress);
REGISTER_SYMBOL(SbSocketWaiterAdd);
REGISTER_SYMBOL(SbSocketWaiterCreate);
Expand Down
3 changes: 0 additions & 3 deletions starboard/linux/shared/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,14 @@ static_library("starboard_platform_sources") {
"//starboard/shared/posix/set_non_blocking_internal.cc",
"//starboard/shared/posix/socket_accept.cc",
"//starboard/shared/posix/socket_bind.cc",
"//starboard/shared/posix/socket_clear_last_error.cc",
"//starboard/shared/posix/socket_connect.cc",
"//starboard/shared/posix/socket_create.cc",
"//starboard/shared/posix/socket_destroy.cc",
"//starboard/shared/posix/socket_get_last_error.cc",
"//starboard/shared/posix/socket_get_local_address.cc",
"//starboard/shared/posix/socket_internal.cc",
"//starboard/shared/posix/socket_is_ipv6_supported.cc",
"//starboard/shared/posix/socket_listen.cc",
"//starboard/shared/posix/socket_receive_from.cc",
"//starboard/shared/posix/socket_send_to.cc",
"//starboard/shared/posix/socket_set_reuse_address.cc",
"//starboard/shared/posix/storage_write_record.cc",
"//starboard/shared/posix/system_break_into_debugger.cc",
Expand Down
3 changes: 2 additions & 1 deletion starboard/nplb/socket_clear_last_error_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

// The Sunny Day test is used in several other tests as the way to detect if the
// error is correct, so it is not repeated here.

#if SB_API_VERSION < 17
madhurajayaraman marked this conversation as resolved.
Show resolved Hide resolved
#include "starboard/common/socket.h"
#include "starboard/nplb/socket_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"
Expand Down Expand Up @@ -46,3 +46,4 @@ TEST(SbSocketClearLastErrorTest, RainyDayInvalidSocket) {
} // namespace
} // namespace nplb
} // namespace starboard
#endif // SB_API_VERSION < 17
3 changes: 2 additions & 1 deletion starboard/nplb/socket_get_last_error_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

// The Sunny Day test is used in several other tests as the way to detect if the
// error is correct, so it is not repeated here.

#if SB_API_VERSION < 17
#include "starboard/common/socket.h"
#include "testing/gtest/include/gtest/gtest.h"

Expand All @@ -29,3 +29,4 @@ TEST(SbSocketGetLastErrorTest, RainyDayInvalidSocket) {
} // namespace
} // namespace nplb
} // namespace starboard
#endif // SB_API_VERSION < 17
2 changes: 0 additions & 2 deletions starboard/nplb/socket_is_connected_and_idle_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ TEST_P(PairSbSocketIsConnectedAndIdleTest, SunnyDay) {
EXPECT_TRUE(SbSocketDestroy(trio.client_socket));
EXPECT_TRUE(SbSocketDestroy(trio.listen_socket));
}
#endif // SB_API_VERSION < 17

TEST_P(SbSocketIsConnectedAndIdleTest, SunnyDayNotConnected) {
SbSocket socket = SbSocketCreate(GetAddressType(), kSbSocketProtocolTcp);
Expand All @@ -89,7 +88,6 @@ TEST_P(SbSocketIsConnectedAndIdleTest, SunnyDayNotConnected) {
EXPECT_TRUE(SbSocketDestroy(socket));
}

#if SB_API_VERSION < 17
TEST_P(SbSocketIsConnectedAndIdleTest, SunnyDayListeningNotConnected) {
SbSocket server_socket =
CreateListeningTcpSocket(GetAddressType(), GetPortNumberForTests());
Expand Down
5 changes: 3 additions & 2 deletions starboard/nplb/socket_receive_from_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if SB_API_VERSION < 17

#include <utility>

#include "starboard/common/socket.h"
Expand Down Expand Up @@ -68,7 +70,6 @@ int Transfer(SbSocket receive_socket,
return size;
}

#if SB_API_VERSION < 17
TEST_P(PairSbSocketReceiveFromTest, SunnyDay) {
const int kBufSize = 256 * 1024;
const int kSockBufSize = kBufSize / 8;
Expand Down Expand Up @@ -133,8 +134,8 @@ INSTANTIATE_TEST_CASE_P(
std::make_pair(kSbSocketAddressTypeIpv6, kSbSocketAddressTypeIpv6),
std::make_pair(kSbSocketAddressTypeIpv6, kSbSocketAddressTypeIpv4)),
GetSbSocketAddressTypePairName);
#endif // SB_API_VERSION < 17

} // namespace
} // namespace nplb
} // namespace starboard
#endif // SB_API_VERSION < 17
3 changes: 0 additions & 3 deletions starboard/raspi/shared/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,14 @@ static_library("starboard_platform_sources") {
"//starboard/shared/posix/set_non_blocking_internal.cc",
"//starboard/shared/posix/socket_accept.cc",
"//starboard/shared/posix/socket_bind.cc",
"//starboard/shared/posix/socket_clear_last_error.cc",
"//starboard/shared/posix/socket_connect.cc",
"//starboard/shared/posix/socket_create.cc",
"//starboard/shared/posix/socket_destroy.cc",
"//starboard/shared/posix/socket_get_last_error.cc",
"//starboard/shared/posix/socket_get_local_address.cc",
"//starboard/shared/posix/socket_internal.cc",
"//starboard/shared/posix/socket_is_ipv6_supported.cc",
"//starboard/shared/posix/socket_listen.cc",
"//starboard/shared/posix/socket_receive_from.cc",
"//starboard/shared/posix/socket_send_to.cc",
"//starboard/shared/posix/socket_set_reuse_address.cc",
"//starboard/shared/posix/storage_write_record.cc",
"//starboard/shared/posix/system_break_into_debugger.cc",
Expand Down
26 changes: 0 additions & 26 deletions starboard/shared/posix/socket_clear_last_error.cc

This file was deleted.

25 changes: 0 additions & 25 deletions starboard/shared/posix/socket_get_last_error.cc

This file was deleted.

96 changes: 0 additions & 96 deletions starboard/shared/posix/socket_send_to.cc

This file was deleted.

Loading
Loading