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

Unified Diff: runtime/bin/socket.cc

Issue 10032027: Add remoteHost to Socket. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed then need for allocating buffer in heap. Created 8 years, 8 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.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket.cc
diff --git a/runtime/bin/socket.cc b/runtime/bin/socket.cc
index 94cb46614a4377aee00fc4fb659811eaf9346558..8a3aa766282d3a2144b28a5bf739a2f5fe61609d 100644
--- a/runtime/bin/socket.cc
+++ b/runtime/bin/socket.cc
@@ -153,15 +153,19 @@ void FUNCTION_NAME(Socket_GetPort)(Dart_NativeArguments args) {
}
-void FUNCTION_NAME(Socket_GetRemotePort)(Dart_NativeArguments args) {
+void FUNCTION_NAME(Socket_GetRemotePeer)(Dart_NativeArguments args) {
Dart_EnterScope();
intptr_t socket =
DartUtils::GetIntegerField(Dart_GetNativeArgument(args, 0),
DartUtils::kIdFieldName);
OSError os_error;
- intptr_t port = Socket::GetRemotePort(socket);
- if (port > 0) {
- Dart_SetReturnValue(args, Dart_NewInteger(port));
+ intptr_t port = 0;
+ char host[DART_INET_ADDRSTRLEN];
+ if (Socket::GetRemotePeer(socket, host, &port)) {
+ Dart_Handle list = Dart_NewList(2);
+ Dart_ListSetAt(list, 0, Dart_NewString(host));
+ Dart_ListSetAt(list, 1, Dart_NewInteger(port));
+ Dart_SetReturnValue(args, list);
} else {
Dart_SetReturnValue(args, DartUtils::NewDartOSError());
}
« no previous file with comments | « runtime/bin/socket.h ('k') | runtime/bin/socket.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698