Commit Graph

20 Commits

Author SHA1 Message Date
ajohnsen@google.com 0117638cf1 Socket.available should never return a negative value.
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10052007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6399 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-11 08:43:34 +00:00
asiva@google.com 2393f17f1a Fix win32 Socket test errors
SocketInfoTest and SocketPortTest are failing on windows.
Review URL: https://chromiumcodereview.appspot.com//10014037

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6390 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-10 23:29:02 +00:00
ajohnsen@google.com 4ecf48b601 Add remoteHost to Socket.
This is merging the native calls into one, GetRemotePeer, thus
eliminating a potentiel extra call to getpeername.

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10032027

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6353 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-10 12:18:12 +00:00
ajohnsen@google.com 1dd508bd44 Add remotePort getter to Socket.
Review URL: https://chromiumcodereview.appspot.com//9963053

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6090 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-02 13:54:03 +00:00
ager@google.com 1ffc9b84a2 Treat EAGAIN/EWOULDBLOCK as requests for retry on socket accept.
On Linux there are a number of protocol errors that can be
returned from accept. According to the linux man pages they
should be treated as EAGAIN.

This should hopefully fix the flakiness of EchoServerStreamTest.

R=iposva@google.com,sgjesse@google.com
BUG=2262
TEST=

Review URL: https://chromiumcodereview.appspot.com//9837060

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5797 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-23 22:39:27 +00:00
sgjesse@google.com 0b3f4a1190 Extend dart:io error handling to all socket functions
There are currently no tests of the error handling, as it is hard to
create consistent tests. I have done some manual tests locally:

* Lowering the number of file descriptors available (ulimit -n) and hitting that limit
* Running two dart programs communicating and terminating one (using Ctrl-C)
* Running two dart programs communicating on two machines and pulling out the network cable.

If there is an error we always call the onError callback and never the onClosed callback.

On Windows there is the issue that both closing the connection correctly and terminating one end gives the same error (ERROR_NETNAME_DELETED) so both are reported as connection close. Pulling out the network cable gives a different (real) error on Windows though.

On Mac OS it turned out the for kqueue EV_EOF is also used to indicate errors with the error code set in the fflags field. EV_ERROR is only reported if there is an internal error in  kevent processing (see http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man2/kqueue.2.html).

R=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9720045

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5709 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-21 09:39:47 +00:00
sgjesse@google.com 168ae8c785 Start better error reporting for sockets
Changed the onError callback for sockets to take an exception argument.

First area to report errors for is name resolution.

Changed the IP address resolution from being synchronous with the
creation of the socket to being asynchronous thsough a lookup
service running on a native port. Currently this lookup service
is static on the socket class as we need to call it from a
factory method. We should probably add a separate name lookup
service at some point.

R=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9699017

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5640 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-19 11:26:41 +00:00
turnidge@google.com 48de07fb60 Start using Dart_PropagateError in the runtime/bin directory.
Review URL: https://chromiumcodereview.appspot.com//9657001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5197 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 23:06:44 +00:00
turnidge@google.com c143d26700 Start using Dart_SetField and Dart_GetField in the vm.
Review URL: https://chromiumcodereview.appspot.com//9642003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5185 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 18:36:56 +00:00
ajohnsen@google.com 20f24769c8 Fix type error
Review URL: https://chromiumcodereview.appspot.com//9249052

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3629 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-26 22:56:50 +00:00
ajohnsen@google.com 56d0e3a746 Send data in chunks when writing to socket.
Review URL: https://chromiumcodereview.appspot.com//9220008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3628 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-26 22:50:26 +00:00
ager@google.com 946b015d0a Fix memory leak in MacOS process handling.
Report error for failing writes. We used to enter a poll loop
because we kept on attempting to write.

Currently the error handling in the socket interface is inconsistent.
We have a big TODO item on general error handling including the socket
interface.

R=sgjesse@google.com
BUG=
TEST=

Review URL: http://codereview.chromium.org//8659032

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1887 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-29 10:10:07 +00:00
ager@google.com 7124c5046b Test for immutable Lists in ListSet API methods.
Using the file and socket API it was possible to modify immutable
arrays.

R=sgjesse@google.com,turnidge@google.com
BUG=
TEST=

Review URL: http://codereview.chromium.org//8575004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1604 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-17 06:57:39 +00:00
sgjesse@google.com 04bc611751 Handle stdin/stdout/stderr on Windows
Create handle objects for stdin/stdout/stderr. For Mac OS and
Linus the file descriptor numbers are used but on Windows the
handles are wrapped in an object.

The system handles for stdin/stdout/stderr on Windows does not
support overlapped IO. To mittigate this the write calls are
performed synchronously and the read calls are preformed in a
thread which posts the result through the completion potr where
it is handled as if it originated from overlapped IO through the
completion port. For now each call to read starts a new thread.

R=ager@google.com

BUG=
TEST=

Review URL: http://codereview.chromium.org//8574002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1533 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-15 13:19:07 +00:00
turnidge@google.com 8c64adf13e Deal with unhandled exceptions the same way in all Dart api functions.
--

Terminology change: invalid handles are now called error handles.

Unhandled exceptions used to be a kind of valid handle.  Now they are
a kind of error handle.

For the Dart_Invoke* functions, this means that the standard
error-checking blob drops from two tests to one test and is
harder to mess up.

Many other Dart api functions (Dart_ToString, for example) previously
dealt with unhandled exceptions by turning them into terse error
messages.  Now these functions preserve information about the
exceptions and generate better error messages.

Changed Dart_HandleMessage to return success/failure.  It seemed to fit.

--

Details:

Dart_IsValid becomes Dart_IsError (negated sense).

Dart_GetError now knows how to print a stack trace semi-nicely.

Dart_ExceptionOccurred -> Dart_IsUnhandledException.

Renamed ApiFailure class to ApiError to fit better.

ApiError now has a "data" pointer that points to either an error
message string or to an unhandled exception object.

Documentation changes aplenty.
Review URL: http://codereview.chromium.org//8501034

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1470 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-11 19:31:04 +00:00
ager@google.com 68166663f9 Renaming Array -> List in the VM API.
BUG=
TEST=

Review URL: http://codereview.chromium.org//8372094

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1195 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-04 12:25:53 +00:00
ager@google.com d864b5e1f6 First round of changes to the file interface.
Have both async and sync version for the file operations. The
thinking is that once you have used an async operation you will
not be allowed to use a sync one. Only sync versions currently
implemented.

Instead of having one input and one output stream associated with a
file we create new streams whenever needed. These get their own
underlying file descriptor so they do not interfere. This means
that FileStreams have to be explicitly closed.

R=sgjesse@google.com
BUG=
TEST=

Review URL: http://codereview.chromium.org//8399033

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@819 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-27 13:33:18 +00:00
turnidge@google.com e756497a78 Refactor the dart api a bit:
- Dart_Result is gone.  Dart_Handle mostly replaces it.
- Name/signature changes
  - IsValidResult -> IsValid
  - GetErrorCString -> GetError
  - many more...
- Make details of persistent handle freelist private.
- Add persistent "True" handle to api state.

Things I am not doing in this changelist:

- Documentation updates
Review URL: http://codereview.chromium.org//8380020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@778 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-26 20:38:41 +00:00
ager@google.com 86284155b9 Improve error handling in the process library.
Verify that the arguments have the types expected by the
implementation. Require a List instance containing builtin
Strings as the arguments. Require a builtin String path.

R=sgjesse@google.com
BUG=
TEST=

Review URL: http://codereview.chromium.org//8383037

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@690 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-25 12:16:04 +00:00
dgrove@google.com 4c0f559d23 Initial checkin.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 05:20:07 +00:00