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

Unified Diff: dart/runtime/bin/socket.cc

Issue 60293003: Version 0.8.10.5 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | « dart/runtime/bin/socket.h ('k') | dart/runtime/bin/socket_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/runtime/bin/socket.cc
===================================================================
--- dart/runtime/bin/socket.cc (revision 29908)
+++ dart/runtime/bin/socket.cc (working copy)
@@ -235,13 +235,24 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
OSError os_error;
intptr_t port = 0;
- ASSERT(INET6_ADDRSTRLEN >= INET_ADDRSTRLEN);
- char host[INET6_ADDRSTRLEN];
- if (Socket::GetRemotePeer(socket, host, &port)) {
+ SocketAddress* addr = Socket::GetRemotePeer(socket, &port);
+ if (addr != NULL) {
Dart_Handle list = Dart_NewList(2);
- Dart_ListSetAt(list, 0, Dart_NewStringFromCString(host));
+
+ Dart_Handle entry = Dart_NewList(3);
+ Dart_ListSetAt(entry, 0, Dart_NewInteger(addr->GetType()));
+ Dart_ListSetAt(entry, 1, Dart_NewStringFromCString(addr->as_string()));
+
+ RawAddr raw = addr->addr();
+ intptr_t data_length = SocketAddress::GetAddrLength(&raw);
+ Dart_Handle data = Dart_NewTypedData(Dart_TypedData_kUint8, data_length);
+ Dart_ListSetAsBytes(data, 0, reinterpret_cast<uint8_t*>(&raw), data_length);
+ Dart_ListSetAt(entry, 2, data);
+
+ Dart_ListSetAt(list, 0, entry);
Dart_ListSetAt(list, 1, Dart_NewInteger(port));
Dart_SetReturnValue(args, list);
+ delete addr;
} else {
Dart_SetReturnValue(args, DartUtils::NewDartOSError());
}
« no previous file with comments | « dart/runtime/bin/socket.h ('k') | dart/runtime/bin/socket_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698