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

Unified Diff: runtime/bin/socket_linux.cc

Issue 9720045: Extend dart:io error handling to all socket functions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 8 years, 9 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_impl.dart ('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 361e2259bb56a5e6d1ce98c08fe5bc6f27cf2d20..5f4096bb75f3120625ccbc2bb3fb705f70fdeeee 100644
--- a/runtime/bin/socket_linux.cc
+++ b/runtime/bin/socket_linux.cc
@@ -95,13 +95,23 @@ intptr_t Socket::GetPort(intptr_t fd) {
getsockname(fd,
reinterpret_cast<struct sockaddr *>(&socket_address),
&size))) {
- fprintf(stderr, "Error getsockname: %s\n", strerror(errno));
return 0;
}
return ntohs(socket_address.sin_port);
}
+void Socket::GetError(intptr_t fd, OSError* os_error) {
+ int len = sizeof(errno);
+ getsockopt(fd,
+ SOL_SOCKET,
+ SO_ERROR,
+ &errno,
+ reinterpret_cast<socklen_t*>(&len));
+ os_error->SetCodeAndMessage(OSError::kSystem, errno);
+}
+
+
intptr_t Socket::GetStdioHandle(int num) {
return static_cast<intptr_t>(num);
}
@@ -121,8 +131,6 @@ const char* Socket::LookupIPv4Address(char* host, OSError** os_error) {
*os_error = new OSError(status,
gai_strerror(status),
OSError::kGetAddressInfo);
- (*os_error)->set_code(status);
- (*os_error)->SetMessage(gai_strerror(status));
return NULL;
}
// Convert the address into IPv4 dotted decimal notation.
« no previous file with comments | « runtime/bin/socket_impl.dart ('k') | runtime/bin/socket_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698