| Index: runtime/bin/socket.cc
|
| ===================================================================
|
| --- runtime/bin/socket.cc (revision 5191)
|
| +++ runtime/bin/socket.cc (working copy)
|
| @@ -13,12 +13,10 @@
|
| void FUNCTION_NAME(Socket_CreateConnect)(Dart_NativeArguments args) {
|
| Dart_EnterScope();
|
| Dart_Handle socketobj = Dart_GetNativeArgument(args, 0);
|
| - const char* host =
|
| - DartUtils::GetStringValue(Dart_GetNativeArgument(args, 1));
|
| - intptr_t port = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2));
|
| + const char* host = DartUtils::GetStringValue(Dart_GetNativeArgument(args, 1));
|
| + int64_t port = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2));
|
| intptr_t socket = Socket::CreateConnect(host, port);
|
| - DartUtils::SetIntegerField(
|
| - socketobj, DartUtils::kIdFieldName, socket);
|
| + DartUtils::SetIntegerField(socketobj, DartUtils::kIdFieldName, socket);
|
| Dart_SetReturnValue(args, Dart_NewBoolean(socket >= 0));
|
| Dart_ExitScope();
|
| }
|
| @@ -26,9 +24,8 @@
|
|
|
| void FUNCTION_NAME(Socket_Available)(Dart_NativeArguments args) {
|
| Dart_EnterScope();
|
| - intptr_t socket =
|
| - DartUtils::GetIntegerField(Dart_GetNativeArgument(args, 0),
|
| - DartUtils::kIdFieldName);
|
| + int64_t socket = DartUtils::GetIntegerField(Dart_GetNativeArgument(args, 0),
|
| + DartUtils::kIdFieldName);
|
| intptr_t available = Socket::Available(socket);
|
| Dart_SetReturnValue(args, Dart_NewInteger(available));
|
| Dart_ExitScope();
|
| @@ -48,7 +45,9 @@
|
| DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 3));
|
| intptr_t buffer_len = 0;
|
| Dart_Handle result = Dart_ListLength(buffer_obj, &buffer_len);
|
| - ASSERT(!Dart_IsError(result));
|
| + if (Dart_IsError(result)) {
|
| + Dart_PropagateError(result);
|
| + }
|
| ASSERT((offset + length) <= buffer_len);
|
|
|
| if (Dart_IsVMFlagSet("short_socket_read")) {
|
| @@ -61,7 +60,8 @@
|
| Dart_Handle result =
|
| Dart_ListSetAsBytes(buffer_obj, offset, buffer, bytes_read);
|
| if (Dart_IsError(result)) {
|
| - bytes_read = -1;
|
| + delete[] buffer;
|
| + Dart_PropagateError(result);
|
| }
|
| }
|
| delete[] buffer;
|
| @@ -83,7 +83,9 @@
|
| DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 3));
|
| intptr_t buffer_len = 0;
|
| Dart_Handle result = Dart_ListLength(buffer_obj, &buffer_len);
|
| - ASSERT(!Dart_IsError(result));
|
| + if (Dart_IsError(result)) {
|
| + Dart_PropagateError(result);
|
| + }
|
| ASSERT((offset + length) <= buffer_len);
|
|
|
| if (Dart_IsVMFlagSet("short_socket_write")) {
|
| @@ -103,7 +105,10 @@
|
| offset + total_bytes_written,
|
| buffer,
|
| chunk_length);
|
| - ASSERT(!Dart_IsError(result));
|
| + if (Dart_IsError(result)) {
|
| + delete[] buffer;
|
| + Dart_PropagateError(result);
|
| + }
|
| bytes_written =
|
| Socket::Write(socket, reinterpret_cast<void*>(buffer), chunk_length);
|
| total_bytes_written += bytes_written;
|
|
|