| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #include "bin/secure_socket.h" | 5 #include "bin/secure_socket.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 ThrowPRException("Failed SSL_ResetHandshake call"); | 706 ThrowPRException("Failed SSL_ResetHandshake call"); |
| 707 } | 707 } |
| 708 | 708 |
| 709 // Set the peer address from the address passed. The DNS has already | 709 // Set the peer address from the address passed. The DNS has already |
| 710 // been done in Dart code, so just use that address. This relies on | 710 // been done in Dart code, so just use that address. This relies on |
| 711 // following about PRNetAddr: "The raw member of the union is | 711 // following about PRNetAddr: "The raw member of the union is |
| 712 // equivalent to struct sockaddr", which is stated in the NSS | 712 // equivalent to struct sockaddr", which is stated in the NSS |
| 713 // documentation. | 713 // documentation. |
| 714 PRNetAddr peername; | 714 PRNetAddr peername; |
| 715 memset(&peername, 0, sizeof(peername)); | 715 memset(&peername, 0, sizeof(peername)); |
| 716 intptr_t len = SocketAddress::GetAddrLength(*raw_addr); | 716 intptr_t len = SocketAddress::GetAddrLength(raw_addr); |
| 717 ASSERT(static_cast<size_t>(len) <= sizeof(peername)); | 717 ASSERT(static_cast<size_t>(len) <= sizeof(peername)); |
| 718 memmove(&peername, &raw_addr->addr, len); | 718 memmove(&peername, &raw_addr->addr, len); |
| 719 | 719 |
| 720 // Adjust the address family field for BSD, whose sockaddr | 720 // Adjust the address family field for BSD, whose sockaddr |
| 721 // structure has a one-byte length and one-byte address family | 721 // structure has a one-byte length and one-byte address family |
| 722 // field at the beginning. PRNetAddr has a two-byte address | 722 // field at the beginning. PRNetAddr has a two-byte address |
| 723 // family field at the beginning. | 723 // family field at the beginning. |
| 724 peername.raw.family = raw_addr->addr.sa_family; | 724 peername.raw.family = raw_addr->addr.sa_family; |
| 725 | 725 |
| 726 memio_SetPeerName(filter_, &peername); | 726 memio_SetPeerName(filter_, &peername); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 // Return a send port for the service port. | 869 // Return a send port for the service port. |
| 870 Dart_Handle send_port = Dart_NewSendPort(service_port); | 870 Dart_Handle send_port = Dart_NewSendPort(service_port); |
| 871 Dart_SetReturnValue(args, send_port); | 871 Dart_SetReturnValue(args, send_port); |
| 872 } | 872 } |
| 873 Dart_ExitScope(); | 873 Dart_ExitScope(); |
| 874 } | 874 } |
| 875 | 875 |
| 876 | 876 |
| 877 } // namespace bin | 877 } // namespace bin |
| 878 } // namespace dart | 878 } // namespace dart |
| OLD | NEW |