Commit Graph

119 Commits

Author SHA1 Message Date
ajohnsen@google.com 9ddf98ffb8 Mark handle as invalid, when datagram socket is closed.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37030 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-05 15:56:59 +00:00
ajohnsen@google.com 58e0c32205 Don't issue new directory reads, if we already got unhandled data.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37006 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-04 18:50:40 +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 30f6999668 Don't try to send messages, when the port is not set.
BUG=https://code.google.com/p/dart/issues/detail?id=18402
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35898 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-08 10:28:31 +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 3b29063492 Don't act on return-token commands on Windows.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33653 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-13 15:23:08 +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 a5d145b1ca Remove non-fatal prints from windows eventhandler.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32964 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-24 14:31:39 +00:00
whesse@google.com 3a896318b6 Revert "Add lock to a file handle in windows event handler."
This reverts commit r32901.  The lock causes a deadlock, and timeouts in tests.

BUG=
R=kustermann@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32906 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-21 17:00:41 +00:00
whesse@google.com cad945de00 Add lock to a file handle in windows event handler.
BUG=
R=ajohnsen@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32901 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-21 15:29:09 +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
ajohnsen@google.com 2cf11a443f Fix Windows event-handler, where write can 'complete' with 0 bytes written.
To match our design, we now treat this as a success write, as we expect the error to come on next issued write (which is exactly what happens).

BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32788 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-19 13:22:46 +00:00
ajohnsen@google.com 140fddd06e Make event-handlers edge-triggered and move socket-state to Dart.
This eliminates to pause/resume calls made in the previous one-shot based model.

BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32780 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-19 09:44:26 +00:00
ajohnsen@google.com 0f52be7f63 Make std* blocking file-descriptors.
This will most likely be a performance regression when piping, that
we'll have to look into in the future (copying data through
    message-passing).

BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32715 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-17 10:06:35 +00:00
ajohnsen@google.com 05d70400d6 Send error-event if socket is marked for error.
BUG=http://code.google.com/p/dart/issues/detail?id=16544
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32358 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-06 14:37:21 +00:00
sgjesse@google.com d651bf7366 Handle failures to AcceptEx calls on Windows
R=ajohnsen@google.com
BUG=http://dartbug.com/11165

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31265 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-19 12:41:26 +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
fschneider@google.com 8779bc8d7f Optimize identical-comparisons based on propagated type information.
If the propagated type allows, eliminate the check for numbers at
identical operations in optimized code.

The previous optimizaton was done before full type propagation was run
and was therefore not very effective.

* Made flow-graph printing having no side-effects: calling Type() lazily
initializes the type_ and reaching_type_ fields of Value and Definition.
Access fields directly when printing instead.

Also, fixed two random spelling mistakes.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28851 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-18 11:13:59 +00:00
ajohnsen@google.com b568dd8e4a Call correct FATAL macro in EventHandler.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28152 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-02 11:46: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
sgjesse@google.com b8912cff07 Replace the memcpy macro with a lint check.
This fixes the build under libc++.  It also allows us to check the
Windows and Android code.  While at it, replace all uncaught instances
of memcpy with memmove.

R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27700 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-20 12:25:08 +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 723930c88e Close 'accepted' sockets when listening socket is closed. Fixes raw_server_socket_cancel_test.
BUG=https://code.google.com/p/dart/issues/detail?id=8675
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25258 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-22 08:54:54 +00:00
ajohnsen@google.com 2d72d895d4 Also check for pending write for FileHandles in EventHandler.
BUG=
R=kustermann@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25228 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-19 17:08:17 +00:00
ajohnsen@google.com 17625ea5a4 Don't call accept the c socket, if we're currently closing.
Fixes a crash on Windows.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25226 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-19 16:52:16 +00:00
ajohnsen@google.com 2bd55c23c7 Keep track of when a socket has been destroyed
This adds the event CLOSED to RawSocket and RawServerSocket. This
event indicate that the underlying socket is now destroyed.

This is used to make Socket.close and ServerSocket.close return a
future which is completed when the unserlying socket is
destroyed. This can be used to start listening on the same port after
closing a server socket.

R=ajohnsen@google.com, kustermann@google.com

BUG=https://code.google.com/p/dart/issues/detail?id=4155

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25213 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-19 13:26:48 +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
sgjesse@google.com 1b3aff5e11 Change async read buffer sizes on Windows
When reading from the console using ReadFile on Windows the buffer size must
be a bit smaller than 32k. Use a 16k buffer in that case and raise the buffer
size to 64k otherwise.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22411 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-06 12:28:45 +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
sgjesse@google.com ea4bc3c941 Change the IO buffer size on Windows to 32k
This makes a program like this

import "dart:io";

main() {
  stdin.pipe(stdout);
}

with stdin redirected from a file run 20 - 50 times faster depending
in the file size piped through.

R=ager@google.com

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20210 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-19 15:26:47 +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
iposva@google.com 9046a44a37 Prepare for removal of source_filter.gypi:
- Guard OS-dependent source files with #if TARGET_OS_* in a similar
  fashion to the architecture dependent sources.
Review URL: https://codereview.chromium.org//12282051

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18786 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-20 21:17:38 +00:00
tball@google.com fe80553fdd Moved GetCurrentTime functions from bin/eventhandler to bin/utils.
Review URL: https://codereview.chromium.org//12280004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18597 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-15 20:51:49 +00:00
sgjesse@google.com 92d5bffe00 Remove Windows line breaks accidentially committed in r18172
TBR=ager@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18174 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-06 15:24:12 +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
ager@google.com cfeb884afd Properly initialize eventhandler mask for all handles on Windows.
The change to make writes to stdout/stderr async exposed this
issue.

R=sgjesse@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16601 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-03 13:16:19 +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
gram@google.com 3601944836 Revised CL for customisable logging (replacing printfs).
Review URL: https://codereview.chromium.org//11312242

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15096 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-19 17:38:15 +00:00