OLD | NEW |
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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 intptr_t port = 0; | 544 intptr_t port = 0; |
545 SocketAddress* addr = Socket::GetRemotePeer(socket, &port); | 545 SocketAddress* addr = Socket::GetRemotePeer(socket, &port); |
546 if (addr != NULL) { | 546 if (addr != NULL) { |
547 Dart_Handle list = Dart_NewList(2); | 547 Dart_Handle list = Dart_NewList(2); |
548 | 548 |
549 Dart_Handle entry = Dart_NewList(3); | 549 Dart_Handle entry = Dart_NewList(3); |
550 Dart_ListSetAt(entry, 0, Dart_NewInteger(addr->GetType())); | 550 Dart_ListSetAt(entry, 0, Dart_NewInteger(addr->GetType())); |
551 Dart_ListSetAt(entry, 1, Dart_NewStringFromCString(addr->as_string())); | 551 Dart_ListSetAt(entry, 1, Dart_NewStringFromCString(addr->as_string())); |
552 | 552 |
553 RawAddr raw = addr->addr(); | 553 RawAddr raw = addr->addr(); |
554 intptr_t data_length = SocketAddress::GetAddrLength(raw); | 554 intptr_t data_length = SocketAddress::GetInAddrLength(raw); |
555 Dart_Handle data = Dart_NewTypedData(Dart_TypedData_kUint8, data_length); | 555 Dart_Handle data = Dart_NewTypedData(Dart_TypedData_kUint8, data_length); |
556 Dart_ListSetAsBytes(data, 0, reinterpret_cast<uint8_t*>(&raw), data_length); | 556 Dart_ListSetAsBytes(data, 0, reinterpret_cast<uint8_t*>(&raw), data_length); |
557 Dart_ListSetAt(entry, 2, data); | 557 Dart_ListSetAt(entry, 2, data); |
558 | 558 |
559 Dart_ListSetAt(list, 0, entry); | 559 Dart_ListSetAt(list, 0, entry); |
560 Dart_ListSetAt(list, 1, Dart_NewInteger(port)); | 560 Dart_ListSetAt(list, 1, Dart_NewInteger(port)); |
561 Dart_SetReturnValue(args, list); | 561 Dart_SetReturnValue(args, list); |
562 delete addr; | 562 delete addr; |
563 } else { | 563 } else { |
564 Dart_SetReturnValue(args, DartUtils::NewDartOSError()); | 564 Dart_SetReturnValue(args, DartUtils::NewDartOSError()); |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 if (Dart_IsError(err)) { | 919 if (Dart_IsError(err)) { |
920 Dart_PropagateError(err); | 920 Dart_PropagateError(err); |
921 } | 921 } |
922 return socket; | 922 return socket; |
923 } | 923 } |
924 | 924 |
925 } // namespace bin | 925 } // namespace bin |
926 } // namespace dart | 926 } // namespace dart |
927 | 927 |
928 #endif // !defined(DART_IO_DISABLED) | 928 #endif // !defined(DART_IO_DISABLED) |
OLD | NEW |