Commit Graph

56 Commits

Author SHA1 Message Date
Zichang Guo fdf4762c99 Reland "[dart:io] Fix hanging on zero-length datagram"
This is a reland of c326c587c5

The fix is to remove "_availableDatagram" check at the start of receive(). Since receive() can be called without receiver being listening, this check will block the receive().

Original change's description:
> [dart:io] Fix hanging on zero-length datagram
>
> This is observed on Win and Linux.
> Here is a doc to explain the problem: https://docs.google.com/document/d/1ZzyBUMrDHLU6vNryjgSMJfUruOdpmTImtE_s2E0J8IQ/edit?usp=sharing.
>
> Bug: https://github.com/dart-lang/sdk/issues/39910
> Change-Id: Ia961239f45615f14108bcd66043ac33d9a0a4abe
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137425
> Commit-Queue: Zichang Guo <zichangguo@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

Bug: https://github.com/dart-lang/sdk/issues/39910
Change-Id: Iefc0af96ed4e1b433396bb5fe11276e8a04c00d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140164
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-03-27 15:28:23 +00:00
Zichang Guo e91e09d1e4 Revert "[dart:io] Fix hanging on zero-length datagram"
This reverts commit c326c587c5.

Reason for revert: Analyzer and Co19 test is broken.

https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8885365974080167440/+/steps/test_results/0/logs/new_test_failures__logs_/0

https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8885364415750725248/+/steps/test_results/0/logs/new_test_failures__logs_/0

Original change's description:
> [dart:io] Fix hanging on zero-length datagram
> 
> This is observed on Win and Linux.
> Here is a doc to explain the problem: https://docs.google.com/document/d/1ZzyBUMrDHLU6vNryjgSMJfUruOdpmTImtE_s2E0J8IQ/edit?usp=sharing.
> 
> Bug: https://github.com/dart-lang/sdk/issues/39910
> Change-Id: Ia961239f45615f14108bcd66043ac33d9a0a4abe
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137425
> Commit-Queue: Zichang Guo <zichangguo@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=sortie@google.com,lrn@google.com,zra@google.com,asiva@google.com,zichangguo@google.com

Change-Id: Id84a7cafbc14d6353fa6af8e294e8b0c751a969f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/39910
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140009
Reviewed-by: Zichang Guo <zichangguo@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-03-19 23:05:59 +00:00
Zichang Guo c326c587c5 [dart:io] Fix hanging on zero-length datagram
This is observed on Win and Linux.
Here is a doc to explain the problem: https://docs.google.com/document/d/1ZzyBUMrDHLU6vNryjgSMJfUruOdpmTImtE_s2E0J8IQ/edit?usp=sharing.

Bug: https://github.com/dart-lang/sdk/issues/39910
Change-Id: Ia961239f45615f14108bcd66043ac33d9a0a4abe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137425
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-03-19 20:23:08 +00:00
Matthew Dempsky 6d5f763952 [vm] Eliminate Mutex/Monitor indirection where possible
In many cases, the Mutexes and Monitors have to be marked "mutable"
because they're used to synchronize const accessor methods.

Small text segment improvement for Product builds:

$ size dart.{arm,x64}.{before,after}
   text	   data	    bss	    dec	    hex	filename
19726069	 409960	 392332	20528361	1393ce9	dart.arm.before
19725525	 409960	 392332	20527817	1393ac9	dart.arm.after
22576021	 600376	1782824	24959221	17cd8f5	dart.x64.before
22574821	 600376	1782824	24958021	17cd445	dart.x64.after

Change-Id: I68f5cd5ad452044df8bfebd160910496036a3e6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101745
Commit-Queue: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-05-13 21:17:51 +00:00
Zachary Anderson 6cd8a79078 VM: Re-format to use at most one newline between functions
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07:00
Zachary Anderson bdb4eb6338 [dart:io][windows] Implements RawSynchronousSocket
related #29343
fixes #29333

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2830273002 .
2017-04-21 23:29:52 -07:00
Erik Corry 4b9bba55b4 Stoppp using trippple consonants
R=ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2833073002 .
2017-04-21 17:50:13 +02:00
Zachary Anderson 8c9c54d833 [dart:io] Don't close stdin with a socket finalizer
If an Isolate touches the 'stdio' getter, a _NativeSocket with
attached finalizer is created for it. Previously, when such an
Isolate exited, the finalizer would close the underlying
file descriptor. This CL changes the finalizer for stdin such
that the native objects will be cleaned up, but the underlying
file descriptor will not be closed. The underlying file
descriptor will now only be closed if the stdin stream
subscription is explicitly canceled.

Accessing the stdin getter after the stream is explicitly
canceled will result in a FileSystemException.

See also: https://github.com/dart-lang/test/issues/583

fixes #29229

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2791423002 .
2017-04-04 13:57:42 -07:00
Zachary Anderson 89dba57bcf [dart:io] Adds a finalizer to _NativeSocket to avoid socket leaks
The finalizer sends the "close" message to the EventHandler for the
file descriptor in the _NativeSocket's native field. To avoid races and
spurious messages, this CL stores a pointer to a wrapper object in the
native field instead of the file descriptor. All messsages about the
_NativeSocket sent to the EventHandler use the wrapper object instead of
the file descriptor. When the EventHandler closes the file, the file
descriptor in the wrapper object is set to -1 so that the finalizer will
instead do nothing.

On Windows, there is another level of indirection since the OS HANDLEs
were already wrapped in various kinds of Handle objects. As an additional
complication, ClientSocket close on Windows is asynchronous, so the
EventHandler may shutdown before all of the ClientSocket Handles can be
destroyed.

related #27898, #28081

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2760293002 .
2017-03-28 07:44:05 -07:00
Zachary Anderson 479a97b129 clang-format runtime/bin
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2480793002 .
2016-11-04 12:30:56 -07:00
Zachary Anderson 103881d01c Make header include guards great again
i.e. #ifndef VM_WHATEVER -> #ifndef RUNTIME_VM_WHATEVER

This lets us remove a hack from the PRESUBMIT.py script that existed
for reasons that are no longer valid, and sets us up to add some
presubmit checks for the GN build.

R=asiva@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/2450713004 .
2016-10-26 00:26:03 -07:00
Zach Anderson 18ec8dddd9 Add back join of windows eventhandler threads
These threads are polluting the exit code despite using the better
ExitProcess call. Instead of adding back Thread::Join, I've instead
inlined the call into the eventhandler to make it easier to be sure
the open handles are closed.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1989463003 .
2016-05-17 14:53:54 -07:00
Zachary Anderson 45661a7091 Cleanup in //runtime/bin
R=iposva@google.com

Review URL: https://codereview.chromium.org/1800863002 .
2016-03-16 10:01:00 -07:00
Zachary Anderson 9395a5b86f Join embedder threads on Windows.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1291163002 .
2015-09-01 17:53:03 -07:00
sgjesse@google.com 7b7ac3620a Add support to specify the source address for socket connect
BUG=http://dartbug.com/22253
R=kustermann@google.com, lrn@google.com

Review URL: https://codereview.chromium.org//908873002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43638 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-10 11:56:51 +00:00
kustermann@google.com 74c0f65c89 Implement windows support for having multiple Dart_Port's registered on one OS socket
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//910863003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43631 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-10 10:08:49 +00:00
kustermann@google.com a7f50cd5d2 Move CircularLinkedList to eventhandler.h
Move constants and InterruptMessage to eventhandler.h

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43524 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-05 21:45:47 +00:00
kustermann@google.com 1d6231bacd Revert "Introduce optional 'bool shared' parameter to ServerSocket.bind() ..."
Review URL: https://codereview.chromium.org//896213002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43476 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-04 16:00:21 +00:00
kustermann@google.com 3c6c29fee9 Introduce optional 'bool shared' parameter to ServerSocket.bind() ...
R=sgjesse@google.com, wibling@google.com

Review URL: https://codereview.chromium.org//879353003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43467 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-04 13:41:41 +00:00
johnmccutchan@google.com 93e840e859 Fix compilation warnings in Windows event handler
BUG=

Review URL: https://codereview.chromium.org//838693002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42649 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-06 22:51:00 +00:00
iposva@google.com 5a383e7add - Make sure that the threads for dart::bin are in the correct namespace.
R=asiva@google.com

Review URL: https://codereview.chromium.org//471743002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39233 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-14 00:06:04 +00:00
iposva@google.com ea4e984b66 - Do not use platform/thread.h
Review URL: https://codereview.chromium.org//462353002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39177 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-12 23:43:45 +00:00
ajohnsen@google.com cee2d6e82e Correctly truncate in Windows eventhandler.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//323823002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37163 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-10 07:12:52 +00:00
ajohnsen@google.com 90db41af31 Fix previous fix, by still making 'handle' the socket.
BUG=

Review URL: https://codereview.chromium.org//316813006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36999 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-04 15:56:47 +00:00
ajohnsen@google.com f8d735521c Don't use same value for socket() and handle(), as they are different concepts.
BUG=
R=kasperl@google.com

Review URL: https://codereview.chromium.org//313083004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36995 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-04 14:16:50 +00:00
ajohnsen@google.com 69a7b746ef Fix double-closing of handles in Windows EventHandler.
BUG=
R=kasperl@google.com

Review URL: https://codereview.chromium.org//315003002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36991 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-04 11:53:53 +00:00
ajohnsen@google.com 146f95135e Use 'Directory.watch' on Windows in pkg/watcher, instead of pooling.
This is a close copy of MacOS, except for the special handling on mac, and the extra watcher on Windows for detecting if the watched folder is deleted.

BUG=https://code.google.com/p/dart/issues/detail?id=14428,https://code.google.com/p/dart/issues/detail?id=18108,http://code.google.com/p/dart/issues/detail?id=19189
R=kasperl@google.com, sgjesse@google.com

Review URL: https://codereview.chromium.org//312743002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36988 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-04 10:23:32 +00:00
ajohnsen@google.com 3e1058fdfd Clean up windows eventhandler.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//265273002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35737 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-05 11:08:03 +00:00
ajohnsen@google.com 82d1382faa Fix crash in raw_secure_server_socket_test.
We had a scenario where read&write events were requested after the socket was closed, leading to a use-after-free.

This also fixes a scenario where we didn't delete client sockets, when accepted sockets are ignored when closing a listening socket.

BUG=https://code.google.com/p/dart/issues/detail?id=18610
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//269003002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35732 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-05 09:17:26 +00:00
ajohnsen@google.com f5b0a17b19 Use ConnectEx on Windows, to do async connect of sockets.
BUG=https://code.google.com/p/dart/issues/detail?id=18154
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//264613002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35622 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-01 10:48:43 +00:00
ajohnsen@google.com 9a71498127 Make the event-handler handle backpreasure.
We now limit the number of active events per fd to 8.

BUG=
R=whesse@google.com

Review URL: https://codereview.chromium.org//198743002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33649 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-13 12:02:47 +00:00
ajohnsen@google.com e3372e72e9 Remove SocketData and now only pass the dart port to epoll.
This avoids keeping extra data alive.

BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//171503009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32846 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-20 08:56:54 +00:00
sgjesse@google.com 7b70c2c267 Add UDP support to dart:io
Initial implementation of UDP support in dart:io

Added a RawDatagramSocket which gets the same events as a RawSocket
except that READ_CLOSED is never received.

The receive from a RawDatagramSocket returns a Datagram object where
the senders address and port is presten together with the data.

The send on a RawDatagramSocket takes data and the address and port of
the destination.

Extended the number of socket options to support UDP.

Added getting the socket options.

R=ajohnsen@google.com
BUG=http://dartbug.com/1975

Review URL: https://codereview.chromium.org//85993002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31098 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-12 15:45:25 +00:00
ajohnsen@google.com 0420c6b8b7 Reuse thread when writing stdout/stderr on Windows.
BUG=https://code.google.com/p/dart/issues/detail?id=13541
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//25631005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28146 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-02 11:03:34 +00:00
ajohnsen@google.com d11df78618 Make stdout and stderr async.
This required some minor changes to the Windows eventhandler, as we now spawn a new thread for writes (just like we do for reads).

BUG=https://code.google.com/p/dart/issues/detail?id=7218
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//23609060

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27811 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-24 11:47:53 +00:00
ajohnsen@google.com 38bae0af02 Add FileSystemWatcher class to dart:io.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//19263003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27048 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-03 12:43:08 +00:00
sgjesse@google.com 959456533f Add Process.runSync for running processes synchronously
BUG=http://dartbug.com/1707

R=whesse@google.com

Review URL: https://codereview.chromium.org//21816002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26052 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-13 14:12:31 +00:00
ajohnsen@google.com 1e2289e275 One event ahndler for all isolates
BUG=
R=whesse@google.com

Review URL: https://codereview.chromium.org//17851004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25082 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-17 07:26:05 +00:00
ajohnsen@google.com b39d2c08ca Implement redirect-stdout-on-close on Winows, to the 'NUL' device.
BUG=https://code.google.com/p/dart/issues/detail?id=11593
R=kustermann@google.com, whesse@google.com

Review URL: https://codereview.chromium.org//18194003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24578 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-28 10:29:21 +00:00
sgjesse@google.com 89a21f2479 Change the timeout handling in the standalone VM to use 64-bit integers
R=floitsch@google.com
BUG=

Review URL: https://codereview.chromium.org//17878002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24466 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-26 13:33:10 +00:00
smok@google.com ebbc2020a2 Put everything in runtime/bin into '::dart::bin' namespace.
Review URL: https://codereview.chromium.org//14341015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22032 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-25 14:22:30 +00:00
ager@google.com 26c4b3a58d Fix file descriptor leak in event handler implementation. When shutting down an isolate, we did not destruct the eventhandler so we leaked the file descriptors for it.
Also fix leak of monitor wait data objects on Windows.

R=sgjesse@google.com
BUG=dartbug.com/9021

Review URL: https://codereview.chromium.org//12646007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19921 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-13 11:11:38 +00:00
sgjesse@google.com 488b016a2f Merge IO v2 branch to bleeding edge
R=ager@google.com, ajohnsen@google.com, whesse@google.com

BUG=

Review URL: https://codereview.chromium.org//12316036

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18820 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-21 11:58:11 +00:00
sgjesse@google.com 79e6b3849f Fix socket error reporting on Windows
An error which happened during writing could be reported as error code 0 (which indicate success). This has been fixed so that the original error is reported.

R=ager@google.com

BUG=

Review URL: https://codereview.chromium.org//12218035

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18171 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-06 14:39:29 +00:00
sgjesse@google.com 606bfd5e96 Reapply "Fixes to eventhandler and HTTP""
This reapplies r16252 with a number of fixes.

R=ager@google.com

BUG=

Review URL: https://codereview.chromium.org//11606020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16306 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-19 08:11:51 +00:00
sgjesse@google.com 310225aabf Revert "Fixes to eventhandler and HTTP"
This reverts commit 21994e29d17b686d71432dfac3bc59e5f2238aa1.

TBR=ager@google.com

BUG=

Review URL: https://codereview.chromium.org//11614028

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16256 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-18 13:21:12 +00:00
sgjesse@google.com e107943e70 Fixes to eventhandler and HTTP
1. Improve error handling in Windows event handler

Whenever an error happens on an IO operation this
generates an error event and the handle is marked as having has
an error.

The test http_shutdown_test have been fixed to check for error as well
as succesful request when the server is closing the connection due to
closing the output stream before the input have been read. The test
have also been extended to have the client send more request data to
get more errors.

2. Disable event handler events until re-enabled from Dart

When an eventhandle event is posted to Dart this event is now
disabled in the eventhandler until re-enabled from Dart.

On Linux and Mac OS this was already the case as the file
descriptor for which the event(s) was posted was removed from
epoll/kqueue when events was posted.

On Windows this is now changed so that after an event is posted
it needs to be re-enabled from Dart code like on Linux and Mac
OS.

Changed the Dart event handler code to avoid posting disabling of
the out handler as the C++ code is already doing this on all
platforms.

3. Cancel HTTP parser when a connection is closing

When a HTTP connection is closing and moved to the close queue
there should be no more envents from the HTTP parser for whatever
data is still buffered.

R=ager@google.com

BUG=7294

Review URL: https://codereview.chromium.org//11623004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16252 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-18 12:32:35 +00:00
ager@google.com 5c9f9ef74f Avoid needless int64_t to intptr_t conversion in eventhandler.
R=sgjesse@google.com
BUG=

Review URL: https://codereview.chromium.org//10962026

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12693 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-21 11:40:40 +00:00
ager@google.com f791a12b38 Terminate event handler thread on isolate shutdown.
R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9251 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-29 14:40:17 +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