Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Unified Diff: runtime/bin/socket_linux.cc

Issue 2515643004: Fuchsia: Partial implementation of dart:io sockets (Closed)
Patch Set: Formatting Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/socket_fuchsia.cc ('k') | runtime/bin/socket_macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_linux.cc
diff --git a/runtime/bin/socket_linux.cc b/runtime/bin/socket_linux.cc
index e3d3103eebeb52606d01940d5136e971e0b1feb9..af5387879c25dc2264d90a96fc3c33a0b4ca245c 100644
--- a/runtime/bin/socket_linux.cc
+++ b/runtime/bin/socket_linux.cc
@@ -28,13 +28,6 @@
namespace dart {
namespace bin {
-static void SaveErrorAndClose(intptr_t fd) {
- int err = errno;
- VOID_TEMP_FAILURE_RETRY(close(fd));
- errno = err;
-}
-
-
SocketAddress::SocketAddress(struct sockaddr* sa) {
ASSERT(INET6_ADDRSTRLEN >= INET_ADDRSTRLEN);
if (!Socket::FormatNumericAddress(*reinterpret_cast<RawAddr*>(sa), as_string_,
@@ -76,7 +69,7 @@ static intptr_t Connect(intptr_t fd, const RawAddr& addr) {
if ((result == 0) || (errno == EINPROGRESS)) {
return fd;
}
- SaveErrorAndClose(fd);
+ FDUtils::FDUtils::SaveErrorAndClose(fd);
return -1;
}
@@ -100,7 +93,7 @@ intptr_t Socket::CreateBindConnect(const RawAddr& addr,
intptr_t result = TEMP_FAILURE_RETRY(
bind(fd, &source_addr.addr, SocketAddress::GetAddrLength(source_addr)));
if ((result != 0) && (errno != EINPROGRESS)) {
- SaveErrorAndClose(fd);
+ FDUtils::SaveErrorAndClose(fd);
return -1;
}
@@ -329,7 +322,7 @@ intptr_t Socket::CreateBindDatagram(const RawAddr& addr, bool reuseAddress) {
if (NO_RETRY_EXPECTED(
bind(fd, &addr.addr, SocketAddress::GetAddrLength(addr))) < 0) {
- SaveErrorAndClose(fd);
+ FDUtils::SaveErrorAndClose(fd);
return -1;
}
return fd;
@@ -415,7 +408,7 @@ intptr_t ServerSocket::CreateBindListen(const RawAddr& addr,
if (NO_RETRY_EXPECTED(
bind(fd, &addr.addr, SocketAddress::GetAddrLength(addr))) < 0) {
- SaveErrorAndClose(fd);
+ FDUtils::SaveErrorAndClose(fd);
return -1;
}
@@ -425,12 +418,12 @@ intptr_t ServerSocket::CreateBindListen(const RawAddr& addr,
// Don't close the socket until we have created a new socket, ensuring
// that we do not get the bad port number again.
intptr_t new_fd = CreateBindListen(addr, backlog, v6_only);
- SaveErrorAndClose(fd);
+ FDUtils::SaveErrorAndClose(fd);
return new_fd;
}
if (NO_RETRY_EXPECTED(listen(fd, backlog > 0 ? backlog : SOMAXCONN)) != 0) {
- SaveErrorAndClose(fd);
+ FDUtils::SaveErrorAndClose(fd);
return -1;
}
@@ -469,11 +462,11 @@ intptr_t ServerSocket::Accept(intptr_t fd) {
}
} else {
if (!FDUtils::SetCloseOnExec(socket)) {
- SaveErrorAndClose(socket);
+ FDUtils::SaveErrorAndClose(socket);
return -1;
}
if (!FDUtils::SetNonBlocking(socket)) {
- SaveErrorAndClose(socket);
+ FDUtils::SaveErrorAndClose(socket);
return -1;
}
}
« no previous file with comments | « runtime/bin/socket_fuchsia.cc ('k') | runtime/bin/socket_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698