| Index: runtime/bin/socket_common.cc
|
| diff --git a/runtime/bin/socket_common.cc b/runtime/bin/socket_common.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..005f74ba8ac31d4293a399bd1e3e6c29f4e54f4f
|
| --- /dev/null
|
| +++ b/runtime/bin/socket_common.cc
|
| @@ -0,0 +1,511 @@
|
| +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +#if !defined(DART_IO_DISABLED)
|
| +
|
| +#include "bin/socket_common.h"
|
| +#include "bin/socket.h"
|
| +
|
| +#include "bin/dartutils.h"
|
| +#include "bin/io_buffer.h"
|
| +#include "bin/isolate_data.h"
|
| +#include "bin/lockers.h"
|
| +#include "bin/thread.h"
|
| +#include "bin/utils.h"
|
| +
|
| +#include "include/dart_api.h"
|
| +
|
| +#include "platform/globals.h"
|
| +#include "platform/utils.h"
|
| +
|
| +namespace dart {
|
| +namespace bin {
|
| +
|
| +static const int kSocketIdNativeField = 0;
|
| +
|
| +bool short_socket_read = false;
|
| +
|
| +bool short_socket_write = false;
|
| +
|
| +void FUNCTION_NAME(InternetAddress_Parse)(Dart_NativeArguments args) {
|
| + const char* address =
|
| + DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
|
| + ASSERT(address != NULL);
|
| + RawAddr raw;
|
| + memset(&raw, 0, sizeof(raw));
|
| + int type = strchr(address, ':') == NULL ? SocketAddress::TYPE_IPV4
|
| + : SocketAddress::TYPE_IPV6;
|
| + if (type == SocketAddress::TYPE_IPV4) {
|
| + raw.addr.sa_family = AF_INET;
|
| + } else {
|
| + raw.addr.sa_family = AF_INET6;
|
| + }
|
| + bool ok = BaseSocket::ParseAddress(type, address, &raw);
|
| + if (!ok) {
|
| + Dart_SetReturnValue(args, Dart_Null());
|
| + } else {
|
| + Dart_SetReturnValue(args, SocketAddress::ToTypedData(raw));
|
| + }
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(NetworkInterface_ListSupported)(Dart_NativeArguments args) {
|
| + Dart_SetReturnValue(args, Dart_NewBoolean(Socket::ListInterfacesSupported()));
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(BaseSocket_IsBindError)(Dart_NativeArguments args) {
|
| + intptr_t error_number =
|
| + DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1));
|
| + bool is_bind_error = BaseSocket::IsBindError(error_number);
|
| + Dart_SetReturnValue(args, is_bind_error ? Dart_True() : Dart_False());
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(BaseSocket_Available)(Dart_NativeArguments args) {
|
| + intptr_t socket =
|
| + BaseSocket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0));
|
| + intptr_t available = BaseSocket::Available(socket);
|
| + if (available >= 0) {
|
| + Dart_SetReturnValue(args, Dart_NewInteger(available));
|
| + } else {
|
| + // Available failed. Mark socket as having data, to trigger a future read
|
| + // event where the actual error can be reported.
|
| + Dart_SetReturnValue(args, Dart_NewInteger(1));
|
| + }
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(BaseSocket_Read)(Dart_NativeArguments args) {
|
| + intptr_t socket =
|
| + BaseSocket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0));
|
| + int64_t length = 0;
|
| + if (DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 1), &length)) {
|
| + if (short_socket_read) {
|
| + length = (length + 1) / 2;
|
| + }
|
| + uint8_t* buffer = NULL;
|
| + Dart_Handle result = IOBuffer::Allocate(length, &buffer);
|
| + if (Dart_IsError(result)) {
|
| + Dart_PropagateError(result);
|
| + }
|
| + ASSERT(buffer != NULL);
|
| + intptr_t bytes_read = BaseSocket::Read(socket, buffer, length);
|
| + if (bytes_read == length) {
|
| + Dart_SetReturnValue(args, result);
|
| + } else if (bytes_read > 0) {
|
| + uint8_t* new_buffer = NULL;
|
| + Dart_Handle new_result = IOBuffer::Allocate(bytes_read, &new_buffer);
|
| + if (Dart_IsError(new_result)) {
|
| + Dart_PropagateError(new_result);
|
| + }
|
| + ASSERT(new_buffer != NULL);
|
| + memmove(new_buffer, buffer, bytes_read);
|
| + Dart_SetReturnValue(args, new_result);
|
| + } else if (bytes_read == 0) {
|
| + // On MacOS when reading from a tty Ctrl-D will result in reading one
|
| + // less byte then reported as available.
|
| + Dart_SetReturnValue(args, Dart_Null());
|
| + } else {
|
| + ASSERT(bytes_read == -1);
|
| + Dart_SetReturnValue(args, DartUtils::NewDartOSError());
|
| + }
|
| + } else {
|
| + OSError os_error(-1, "Invalid argument", OSError::kUnknown);
|
| + Dart_SetReturnValue(args, DartUtils::NewDartOSError(&os_error));
|
| + }
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(BaseSocket_RecvFrom)(Dart_NativeArguments args) {
|
| + intptr_t socket =
|
| + BaseSocket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0));
|
| +
|
| + // TODO(sgjesse): Use a MTU value here. Only the loopback adapter can
|
| + // handle 64k datagrams.
|
| + IsolateData* isolate_data =
|
| + reinterpret_cast<IsolateData*>(Dart_CurrentIsolateData());
|
| + if (isolate_data->udp_receive_buffer == NULL) {
|
| + isolate_data->udp_receive_buffer =
|
| + reinterpret_cast<uint8_t*>(malloc(65536));
|
| + }
|
| + RawAddr addr;
|
| + intptr_t bytes_read = BaseSocket::RecvFrom(
|
| + socket, isolate_data->udp_receive_buffer, 65536, &addr);
|
| + if (bytes_read == 0) {
|
| + Dart_SetReturnValue(args, Dart_Null());
|
| + return;
|
| + }
|
| + if (bytes_read < 0) {
|
| + ASSERT(bytes_read == -1);
|
| + Dart_SetReturnValue(args, DartUtils::NewDartOSError());
|
| + return;
|
| + }
|
| + // Datagram data read. Copy into buffer of the exact size,
|
| + ASSERT(bytes_read > 0);
|
| + uint8_t* data_buffer = NULL;
|
| + Dart_Handle data = IOBuffer::Allocate(bytes_read, &data_buffer);
|
| + if (Dart_IsError(data)) {
|
| + Dart_PropagateError(data);
|
| + }
|
| + ASSERT(data_buffer != NULL);
|
| + memmove(data_buffer, isolate_data->udp_receive_buffer, bytes_read);
|
| +
|
| + // Get the port and clear it in the sockaddr structure.
|
| + int port = SocketAddress::GetAddrPort(addr);
|
| + if (addr.addr.sa_family == AF_INET) {
|
| + addr.in.sin_port = 0;
|
| + } else {
|
| + ASSERT(addr.addr.sa_family == AF_INET6);
|
| + addr.in6.sin6_port = 0;
|
| + }
|
| + // Format the address to a string using the numeric format.
|
| + char numeric_address[INET6_ADDRSTRLEN];
|
| + BaseSocket::FormatNumericAddress(addr, numeric_address, INET6_ADDRSTRLEN);
|
| +
|
| + // Create a Datagram object with the data and sender address and port.
|
| + const int kNumArgs = 4;
|
| + Dart_Handle dart_args[kNumArgs];
|
| + dart_args[0] = data;
|
| + dart_args[1] = Dart_NewStringFromCString(numeric_address);
|
| + if (Dart_IsError(dart_args[1])) {
|
| + Dart_PropagateError(dart_args[1]);
|
| + }
|
| + dart_args[2] = SocketAddress::ToTypedData(addr);
|
| + dart_args[3] = Dart_NewInteger(port);
|
| + if (Dart_IsError(dart_args[3])) {
|
| + Dart_PropagateError(dart_args[3]);
|
| + }
|
| + // TODO(sgjesse): Cache the _makeDatagram function somewhere.
|
| + Dart_Handle io_lib = Dart_LookupLibrary(DartUtils::NewString("dart:io"));
|
| + if (Dart_IsError(io_lib)) {
|
| + Dart_PropagateError(io_lib);
|
| + }
|
| + Dart_Handle result = Dart_Invoke(
|
| + io_lib, DartUtils::NewString("_makeDatagram"), kNumArgs, dart_args);
|
| + Dart_SetReturnValue(args, result);
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(BaseSocket_WriteList)(Dart_NativeArguments args) {
|
| + intptr_t socket =
|
| + BaseSocket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0));
|
| + Dart_Handle buffer_obj = Dart_GetNativeArgument(args, 1);
|
| + ASSERT(Dart_IsList(buffer_obj));
|
| + intptr_t offset = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 2));
|
| + intptr_t length = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 3));
|
| + bool short_write = false;
|
| + if (short_socket_write) {
|
| + if (length > 1) {
|
| + short_write = true;
|
| + }
|
| + length = (length + 1) / 2;
|
| + }
|
| + Dart_TypedData_Type type;
|
| + uint8_t* buffer = NULL;
|
| + intptr_t len;
|
| + Dart_Handle result = Dart_TypedDataAcquireData(
|
| + buffer_obj, &type, reinterpret_cast<void**>(&buffer), &len);
|
| + if (Dart_IsError(result)) {
|
| + Dart_PropagateError(result);
|
| + }
|
| + ASSERT((offset + length) <= len);
|
| + buffer += offset;
|
| + intptr_t bytes_written = BaseSocket::Write(socket, buffer, length);
|
| + if (bytes_written >= 0) {
|
| + Dart_TypedDataReleaseData(buffer_obj);
|
| + if (short_write) {
|
| + // If the write was forced 'short', indicate by returning the negative
|
| + // number of bytes. A forced short write may not trigger a write event.
|
| + Dart_SetReturnValue(args, Dart_NewInteger(-bytes_written));
|
| + } else {
|
| + Dart_SetReturnValue(args, Dart_NewInteger(bytes_written));
|
| + }
|
| + } else {
|
| + // Extract OSError before we release data, as it may override the error.
|
| + OSError os_error;
|
| + Dart_TypedDataReleaseData(buffer_obj);
|
| + Dart_SetReturnValue(args, DartUtils::NewDartOSError(&os_error));
|
| + }
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(BaseSocket_SendTo)(Dart_NativeArguments args) {
|
| + intptr_t socket =
|
| + BaseSocket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0));
|
| + Dart_Handle buffer_obj = Dart_GetNativeArgument(args, 1);
|
| + intptr_t offset = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 2));
|
| + intptr_t length = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 3));
|
| + Dart_Handle address_obj = Dart_GetNativeArgument(args, 4);
|
| + ASSERT(Dart_IsList(address_obj));
|
| + RawAddr addr;
|
| + SocketAddress::GetSockAddr(address_obj, &addr);
|
| + int64_t port = DartUtils::GetInt64ValueCheckRange(
|
| + Dart_GetNativeArgument(args, 5), 0, 65535);
|
| + SocketAddress::SetAddrPort(&addr, port);
|
| + Dart_TypedData_Type type;
|
| + uint8_t* buffer = NULL;
|
| + intptr_t len;
|
| + Dart_Handle result = Dart_TypedDataAcquireData(
|
| + buffer_obj, &type, reinterpret_cast<void**>(&buffer), &len);
|
| + if (Dart_IsError(result)) {
|
| + Dart_PropagateError(result);
|
| + }
|
| + ASSERT((offset + length) <= len);
|
| + buffer += offset;
|
| + intptr_t bytes_written = BaseSocket::SendTo(socket, buffer, length, addr);
|
| + if (bytes_written >= 0) {
|
| + Dart_TypedDataReleaseData(buffer_obj);
|
| + Dart_SetReturnValue(args, Dart_NewInteger(bytes_written));
|
| + } else {
|
| + // Extract OSError before we release data, as it may override the error.
|
| + OSError os_error;
|
| + Dart_TypedDataReleaseData(buffer_obj);
|
| + Dart_SetReturnValue(args, DartUtils::NewDartOSError(&os_error));
|
| + }
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(BaseSocket_GetPort)(Dart_NativeArguments args) {
|
| + intptr_t socket =
|
| + BaseSocket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0));
|
| + OSError os_error;
|
| + intptr_t port = BaseSocket::GetPort(socket);
|
| + if (port > 0) {
|
| + Dart_SetReturnValue(args, Dart_NewInteger(port));
|
| + } else {
|
| + Dart_SetReturnValue(args, DartUtils::NewDartOSError());
|
| + }
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(BaseSocket_GetRemotePeer)(Dart_NativeArguments args) {
|
| + intptr_t socket =
|
| + BaseSocket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0));
|
| + OSError os_error;
|
| + intptr_t port = 0;
|
| + SocketAddress* addr = BaseSocket::GetRemotePeer(socket, &port);
|
| + if (addr != NULL) {
|
| + Dart_Handle list = Dart_NewList(2);
|
| +
|
| + 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();
|
| + Dart_ListSetAt(entry, 2, SocketAddress::ToTypedData(raw));
|
| +
|
| + Dart_ListSetAt(list, 0, entry);
|
| + Dart_ListSetAt(list, 1, Dart_NewInteger(port));
|
| + Dart_SetReturnValue(args, list);
|
| + delete addr;
|
| + } else {
|
| + Dart_SetReturnValue(args, DartUtils::NewDartOSError());
|
| + }
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(BaseSocket_GetError)(Dart_NativeArguments args) {
|
| + intptr_t socket =
|
| + BaseSocket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0));
|
| + OSError os_error;
|
| + BaseSocket::GetError(socket, &os_error);
|
| + Dart_SetReturnValue(args, DartUtils::NewDartOSError(&os_error));
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(BaseSocket_GetType)(Dart_NativeArguments args) {
|
| + intptr_t socket =
|
| + BaseSocket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0));
|
| + OSError os_error;
|
| + intptr_t type = BaseSocket::GetType(socket);
|
| + if (type >= 0) {
|
| + Dart_SetReturnValue(args, Dart_NewInteger(type));
|
| + } else {
|
| + Dart_SetReturnValue(args, DartUtils::NewDartOSError());
|
| + }
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(BaseSocket_GetStdioHandle)(Dart_NativeArguments args) {
|
| + int64_t num =
|
| + DartUtils::GetInt64ValueCheckRange(Dart_GetNativeArgument(args, 1), 0, 2);
|
| + intptr_t socket = BaseSocket::GetStdioHandle(num);
|
| + BaseSocket::SetSocketIdNativeField(Dart_GetNativeArgument(args, 0), socket);
|
| + Dart_SetReturnValue(args, Dart_NewBoolean(socket >= 0));
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(BaseSocket_GetSocketId)(Dart_NativeArguments args) {
|
| + intptr_t id =
|
| + BaseSocket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0));
|
| + Dart_SetReturnValue(args, Dart_NewInteger(id));
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(BaseSocket_SetSocketId)(Dart_NativeArguments args) {
|
| + intptr_t id = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1));
|
| + BaseSocket::SetSocketIdNativeField(Dart_GetNativeArgument(args, 0), id);
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(BaseSocket_GetOption)(Dart_NativeArguments args) {
|
| + intptr_t socket =
|
| + BaseSocket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0));
|
| + int64_t option = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 1));
|
| + intptr_t protocol = static_cast<intptr_t>(
|
| + DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2)));
|
| + bool ok = false;
|
| + switch (option) {
|
| + case 0: { // TCP_NODELAY.
|
| + bool enabled;
|
| + ok = BaseSocket::GetNoDelay(socket, &enabled);
|
| + if (ok) {
|
| + Dart_SetReturnValue(args, enabled ? Dart_True() : Dart_False());
|
| + }
|
| + break;
|
| + }
|
| + case 1: { // IP_MULTICAST_LOOP.
|
| + bool enabled;
|
| + ok = BaseSocket::GetMulticastLoop(socket, protocol, &enabled);
|
| + if (ok) {
|
| + Dart_SetReturnValue(args, enabled ? Dart_True() : Dart_False());
|
| + }
|
| + break;
|
| + }
|
| + case 2: { // IP_MULTICAST_TTL.
|
| + int value;
|
| + ok = BaseSocket::GetMulticastHops(socket, protocol, &value);
|
| + if (ok) {
|
| + Dart_SetReturnValue(args, Dart_NewInteger(value));
|
| + }
|
| + break;
|
| + }
|
| + case 3: { // IP_MULTICAST_IF.
|
| + UNIMPLEMENTED();
|
| + break;
|
| + }
|
| + case 4: { // IP_BROADCAST.
|
| + bool enabled;
|
| + ok = BaseSocket::GetBroadcast(socket, &enabled);
|
| + if (ok) {
|
| + Dart_SetReturnValue(args, enabled ? Dart_True() : Dart_False());
|
| + }
|
| + break;
|
| + }
|
| + default:
|
| + UNREACHABLE();
|
| + break;
|
| + }
|
| + // In case of failure the return value is not set above.
|
| + if (!ok) {
|
| + Dart_SetReturnValue(args, DartUtils::NewDartOSError());
|
| + }
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(BaseSocket_SetOption)(Dart_NativeArguments args) {
|
| + bool result = false;
|
| + intptr_t socket =
|
| + BaseSocket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0));
|
| + int64_t option = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 1));
|
| + int64_t protocol = DartUtils::GetInt64ValueCheckRange(
|
| + Dart_GetNativeArgument(args, 2), SocketAddress::TYPE_IPV4,
|
| + SocketAddress::TYPE_IPV6);
|
| + switch (option) {
|
| + case 0: // TCP_NODELAY.
|
| + result = BaseSocket::SetNoDelay(
|
| + socket, DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 3)));
|
| + break;
|
| + case 1: // IP_MULTICAST_LOOP.
|
| + result = BaseSocket::SetMulticastLoop(
|
| + socket, protocol,
|
| + DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 3)));
|
| + break;
|
| + case 2: // IP_MULTICAST_TTL.
|
| + result = BaseSocket::SetMulticastHops(
|
| + socket, protocol,
|
| + DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 3)));
|
| + break;
|
| + case 3: { // IP_MULTICAST_IF.
|
| + UNIMPLEMENTED();
|
| + break;
|
| + }
|
| + case 4: // IP_BROADCAST.
|
| + result = BaseSocket::SetBroadcast(
|
| + socket, DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 3)));
|
| + break;
|
| + default:
|
| + Dart_PropagateError(Dart_NewApiError("Value outside expected range"));
|
| + break;
|
| + }
|
| + if (result) {
|
| + Dart_SetReturnValue(args, Dart_Null());
|
| + } else {
|
| + Dart_SetReturnValue(args, DartUtils::NewDartOSError());
|
| + }
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(BaseSocket_JoinMulticast)(Dart_NativeArguments args) {
|
| + intptr_t socket =
|
| + BaseSocket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0));
|
| + RawAddr addr;
|
| + SocketAddress::GetSockAddr(Dart_GetNativeArgument(args, 1), &addr);
|
| + RawAddr interface;
|
| + if (Dart_GetNativeArgument(args, 2) != Dart_Null()) {
|
| + SocketAddress::GetSockAddr(Dart_GetNativeArgument(args, 2), &interface);
|
| + }
|
| + int interfaceIndex =
|
| + DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 3));
|
| + if (BaseSocket::JoinMulticast(socket, addr, interface, interfaceIndex)) {
|
| + Dart_SetReturnValue(args, Dart_Null());
|
| + } else {
|
| + Dart_SetReturnValue(args, DartUtils::NewDartOSError());
|
| + }
|
| +}
|
| +
|
| +
|
| +void FUNCTION_NAME(BaseSocket_LeaveMulticast)(Dart_NativeArguments args) {
|
| + intptr_t socket =
|
| + BaseSocket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0));
|
| + RawAddr addr;
|
| + SocketAddress::GetSockAddr(Dart_GetNativeArgument(args, 1), &addr);
|
| + RawAddr interface;
|
| + if (Dart_GetNativeArgument(args, 2) != Dart_Null()) {
|
| + SocketAddress::GetSockAddr(Dart_GetNativeArgument(args, 2), &interface);
|
| + }
|
| + int interfaceIndex =
|
| + DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 3));
|
| + if (Socket::LeaveMulticast(socket, addr, interface, interfaceIndex)) {
|
| + Dart_SetReturnValue(args, Dart_Null());
|
| + } else {
|
| + Dart_SetReturnValue(args, DartUtils::NewDartOSError());
|
| + }
|
| +}
|
| +
|
| +
|
| +void BaseSocket::SetSocketIdNativeField(Dart_Handle socket, intptr_t id) {
|
| + Dart_Handle err =
|
| + Dart_SetNativeInstanceField(socket, kSocketIdNativeField, id);
|
| + if (Dart_IsError(err)) {
|
| + Dart_PropagateError(err);
|
| + }
|
| +}
|
| +
|
| +
|
| +intptr_t BaseSocket::GetSocketIdNativeField(Dart_Handle socket_obj) {
|
| + intptr_t socket = 0;
|
| + Dart_Handle err =
|
| + Dart_GetNativeInstanceField(socket_obj, kSocketIdNativeField, &socket);
|
| + if (Dart_IsError(err)) {
|
| + Dart_PropagateError(err);
|
| + }
|
| + return socket;
|
| +}
|
| +
|
| +} // namespace bin
|
| +} // namespace dart
|
| +
|
| +#endif // !defined(DART_IO_DISABLED)
|
|
|