| Index: runtime/bin/socket_macos.cc
|
| diff --git a/runtime/bin/socket_macos.cc b/runtime/bin/socket_macos.cc
|
| index 94363fb74f45bb0b38c8134018b3776b387d895f..40b92cfa53ab99d2adaae369e6cb21f82a325016 100644
|
| --- a/runtime/bin/socket_macos.cc
|
| +++ b/runtime/bin/socket_macos.cc
|
| @@ -42,18 +42,21 @@ bool Socket::Initialize() {
|
| }
|
|
|
|
|
| -intptr_t Socket::CreateConnect(RawAddr addr, const intptr_t port) {
|
| +intptr_t Socket::Create(RawAddr addr) {
|
| intptr_t fd;
|
|
|
| fd = TEMP_FAILURE_RETRY(socket(addr.ss.ss_family, SOCK_STREAM, 0));
|
| if (fd < 0) {
|
| - Log::PrintErr("Error CreateConnect: %s\n", strerror(errno));
|
| + Log::PrintErr("Error Create: %s\n", strerror(errno));
|
| return -1;
|
| }
|
|
|
| FDUtils::SetCloseOnExec(fd);
|
| - Socket::SetNonBlocking(fd);
|
| + return fd;
|
| +}
|
|
|
| +
|
| +intptr_t Socket::Connect(intptr_t fd, RawAddr addr, const intptr_t port) {
|
| SocketAddress::SetAddrPort(&addr, port);
|
| intptr_t result = TEMP_FAILURE_RETRY(
|
| connect(fd,
|
| @@ -67,6 +70,18 @@ intptr_t Socket::CreateConnect(RawAddr addr, const intptr_t port) {
|
| }
|
|
|
|
|
| +intptr_t Socket::CreateConnect(RawAddr addr, const intptr_t port) {
|
| + intptr_t fd = Socket::Create(addr);
|
| + if (fd < 0) {
|
| + return fd;
|
| + }
|
| +
|
| + Socket::SetNonBlocking(fd);
|
| +
|
| + return Socket::Connect(fd, addr, port);
|
| +}
|
| +
|
| +
|
| intptr_t Socket::Available(intptr_t fd) {
|
| return FDUtils::AvailableBytes(fd);
|
| }
|
|
|