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

Unified Diff: runtime/bin/socket_android.cc

Issue 15966002: Add support for loading scripts from http (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 months 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.h ('k') | runtime/bin/socket_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_android.cc
diff --git a/runtime/bin/socket_android.cc b/runtime/bin/socket_android.cc
index 20715a39b06375f89a4b5ab9d8b6098ddf2c8fdf..c0fbacd8781a8ec7d2983b457d6d9ca83c1b1412 100644
--- a/runtime/bin/socket_android.cc
+++ b/runtime/bin/socket_android.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,
@@ -62,11 +65,23 @@ intptr_t Socket::CreateConnect(RawAddr addr, const intptr_t port) {
if (result == 0 || errno == EINPROGRESS) {
return fd;
}
- TEMP_FAILURE_RETRY(close(fd));
+ VOID_TEMP_FAILURE_RETRY(close(fd));
return -1;
}
+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);
}
« no previous file with comments | « runtime/bin/socket.h ('k') | runtime/bin/socket_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698