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

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: 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..6ec91037f24311582fa1dd86c6525185d3770065 100644
--- a/runtime/bin/socket.cc
+++ b/runtime/bin/socket.cc
@@ -153,15 +153,20 @@ 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;
+ const char *host = NULL;
Søren Gjesse 2012/04/10 11:32:41 How about char host[INET_ADDRSTRLEN]; here? Then
+ 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);
+ delete[] host;
} 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