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

Side by Side Diff: runtime/bin/socket.cc

Issue 2665973003: Fix peer addresses being reported raw rather than the actual address byte. (Closed)
Patch Set: Add testcases Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | tests/standalone/io/socket_info_ipv4_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #if !defined(DART_IO_DISABLED) 5 #if !defined(DART_IO_DISABLED)
6 6
7 #include "bin/socket.h" 7 #include "bin/socket.h"
8 8
9 #include "bin/dartutils.h" 9 #include "bin/dartutils.h"
10 #include "bin/io_buffer.h" 10 #include "bin/io_buffer.h"
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 intptr_t port = 0; 570 intptr_t port = 0;
571 SocketAddress* addr = Socket::GetRemotePeer(socket, &port); 571 SocketAddress* addr = Socket::GetRemotePeer(socket, &port);
572 if (addr != NULL) { 572 if (addr != NULL) {
573 Dart_Handle list = Dart_NewList(2); 573 Dart_Handle list = Dart_NewList(2);
574 574
575 Dart_Handle entry = Dart_NewList(3); 575 Dart_Handle entry = Dart_NewList(3);
576 Dart_ListSetAt(entry, 0, Dart_NewInteger(addr->GetType())); 576 Dart_ListSetAt(entry, 0, Dart_NewInteger(addr->GetType()));
577 Dart_ListSetAt(entry, 1, Dart_NewStringFromCString(addr->as_string())); 577 Dart_ListSetAt(entry, 1, Dart_NewStringFromCString(addr->as_string()));
578 578
579 RawAddr raw = addr->addr(); 579 RawAddr raw = addr->addr();
580 intptr_t data_length = SocketAddress::GetInAddrLength(raw); 580 Dart_ListSetAt(entry, 2, SocketAddress::ToTypedData(raw));
581 Dart_Handle data = Dart_NewTypedData(Dart_TypedData_kUint8, data_length);
582 Dart_ListSetAsBytes(data, 0, reinterpret_cast<uint8_t*>(&raw), data_length);
583 Dart_ListSetAt(entry, 2, data);
584 581
585 Dart_ListSetAt(list, 0, entry); 582 Dart_ListSetAt(list, 0, entry);
586 Dart_ListSetAt(list, 1, Dart_NewInteger(port)); 583 Dart_ListSetAt(list, 1, Dart_NewInteger(port));
587 Dart_SetReturnValue(args, list); 584 Dart_SetReturnValue(args, list);
588 delete addr; 585 delete addr;
589 } else { 586 } else {
590 Dart_SetReturnValue(args, DartUtils::NewDartOSError()); 587 Dart_SetReturnValue(args, DartUtils::NewDartOSError());
591 } 588 }
592 } 589 }
593 590
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 if (Dart_IsError(err)) { 942 if (Dart_IsError(err)) {
946 Dart_PropagateError(err); 943 Dart_PropagateError(err);
947 } 944 }
948 return socket; 945 return socket;
949 } 946 }
950 947
951 } // namespace bin 948 } // namespace bin
952 } // namespace dart 949 } // namespace dart
953 950
954 #endif // !defined(DART_IO_DISABLED) 951 #endif // !defined(DART_IO_DISABLED)
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/socket_info_ipv4_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698