Commit Graph

71 Commits

Author SHA1 Message Date
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
ajohnsen@google.com 3dfe7c97e2 Always initialize the EventHandler in the standalone.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26517 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-22 12:03:59 +00:00
kevmoo@j832.com 178afc3105 because Kasper cares
R=kasperl@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26286 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-16 18:04:48 +00:00
ajohnsen@google.com 7451cf3add Fix a Socket edge-case where the socket is closed by peer right after accept, where we havn't set a close-handler yet.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25732 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-02 13:12:24 +00:00
ajohnsen@google.com 2d43c9b0b8 Report correct socket error and use HttpServer:close future in pub.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25332 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-23 08:59:23 +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 32ef8cdecf Add 'address' and 'port' to SocketException, and include them in toString().
BUG=
R=whesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24784 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-05 12:36:10 +00:00
whesse@google.com 686724212d dart:io | Pass errors from multithreaded encryption back to Dart.
BUG=dartbug.com/11383
R=ajohnsen@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24765 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-04 09:21:01 +00:00
sgjesse@google.com 6783eaecbd Fix checked mode error in previous commit
TBR=ajohnsen@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24399 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-25 12:11:45 +00:00
sgjesse@google.com 8a2a138ed2 Detect EOF when reading stdio from terminal on Mac OS
R=ajohnsen@google.com
BUG=http://dartbug.com/453

patch from issue 17381012

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24397 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-25 11:47:55 +00:00
ajohnsen@google.com 3ad9779be6 Add reverse dns lookup as a method on InternetAddress.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24393 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-25 11:27:48 +00:00
ajohnsen@google.com 4624420914 Add NetworkAdaptor to dart:io.
NetworkAdaptor contains a static method, list, that will query the
underlaying system for active network adaptors.

BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24267 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-21 07:58:48 +00:00
sgjesse@google.com 54f6939ffc Ensure that there is no "hidden" DNS lookup in secure socket code
The required setting of the internet adddress of the peer for NSS is
now using the internet address which have already been looked up in
Dart code for normal secure socket connect.

In the cases where SecureSocket.secure and RawSecureSocket.secure is
used with a host name, the internet address of the already connected
socket will be used. If that is not sufficient an IntetnetAddress from
DNS lookup in Dart can be passed instead of just a host name.

R=ajohnsen@google.com, whesse@google.com
BUG=http://dartbug.com/11103

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24174 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-19 09:07:43 +00:00
sgjesse@google.com 55709f1f43 Ensure that only byte values are sent by sockets and web sockets
R=ajohnsen@google.com
BUG=http://dartbug.com/11007

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23896 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-12 08:33:16 +00:00
ajohnsen@google.com 5ce3b9ddea Clean up dart:io exceptions.
- Introduce IOException.
- Remove HttpParserException.
- Merge RedirectLimitExceededException and RedirectLoopException into
RedirectException.
- Remove 'IO' from FileIOException, DirectoryIOException, LinkIOException
and SocketIOException.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23848 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-11 13:15:46 +00:00
lrn@google.com faa7227cec Make new StreamController be async by default.
Change all instances, except some tests, to be sync still.
Rename Multiplex to Broadcast everywhere.

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23453 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-31 06:07:39 +00:00
lrn@google.com 39c8f31441 Make new StreamController().isPaused be true until the first listener arrives.
This is compatible with what we had before, and makes good sense if you read
"isPaused" as "must buffer incoming events".

R=floitsch@google.com, sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23318 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-29 05:39:23 +00:00
lrn@google.com 781e84284f Reapply "Active stream subscriptions".
Makes subscriptions the active part of a stream, with the stream
itself being just an inert creator of subscriptions.

This changes the behavior of a "single subscription" stream to match
the documentation: After the subscription is canceled, you can't
resubscribe to the stream. Previously, you could do that, but it was
never documented or intended.
This also makes the stream of a StreamController not be paused while
before it's subscribed - it is always the subscription that is paused
or not, and while there is no subscription, the stream cannot be
paused. Previously the stream was set to paused until the first
subscription in order to prevent events from being lost. That is
handled independently of pauses now.

Adds StreamController.multiplex constructor. This name is tentative,
and likely to change. Its behavior may change as well. It currently
provides a new single-subscription stream each time its "stream"
getter is read, and you can subscribe to these.

Adds StreamIterator class that allows iterating over a stream's data
events using (async) "moveNext()" and "current", like a direct style
Iterator (sorry, it won't work in a for-in loop).

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23237 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-28 07:28:36 +00:00
lrn@google.com cc0d9d57af Revert until Windows crash is debugged.
Reverts r23218, r23217, r23208, r23207, r23206, r23205, r23204.

r23218 | Path observer is listened more than once, so make it multiplex.
r23217 | Add StreamController.multiplex constructor.
r23208 | Fix bug in streamimpl
r23207 | Fix bug in stream iterator.
r23206 | Change expectations for http_parser_test.
r23205 | Fix bug in stream-impl.
r23204 | Make StreamSubscription be the active part of a string.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23221 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-27 13:03:03 +00:00
lrn@google.com ee1c11a2a6 Make StreamSubscription be the active part of a string.
It is the one keeping the buffer of events, not the stream.

R=ajohnsen@google.com, floitsch@google.com, jmesserly@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23204 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-27 08:34:20 +00:00
asiva@google.com 1792aa6bf3 Change SecureSocket to use a single patch class instead of multiple patch classes the way it is being done now.
R=ager@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23087 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-23 17:54:32 +00:00
ajohnsen@google.com f06faf4a48 Remove explicit delayed futures in dart:io.
After the change of Completers always being delayed to the next tick,
      this is no longer needed.

BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22984 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-22 07:23:18 +00:00
ajohnsen@google.com 6a78c0c0b8 Add v6Only named argument to ServerSocket and etc.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22309 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-02 11:23:40 +00:00
ajohnsen@google.com a516bbc22d Enable IPv6 by default in dart:io.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22240 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-01 12:18:53 +00:00
sgjesse@google.com 2fdb878ebe Change the signature for all network bind calls.
All the bind calls on RawServerSocket, ServerSocket,
RawSecureServerSocket, SecureServerSocket and HttpServer (and
bindSecure on HttpServer) now have mandatory address and port
parameters. All the rest of the parameters are named optional
(including backlog).

The address parameter can be an InternetAddress or a String for all
these calls.

R=ajohnsen@google.com, whesse@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22227 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-01 09:14:04 +00:00
sgjesse@google.com 6c486c72cd Add static getters for common internet addresses
R=whesse@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22174 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-30 11:30:05 +00:00
ajohnsen@google.com ca706b0387 Disable IPv6 lookup by default.
Will revert once IPv6 have stablized.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21936 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-24 10:25:25 +00:00
ajohnsen@google.com 55963a1a6d Add new InternetAddress class with a static lookup function (including IPv6
results).

Reapply of https://codereview.chromium.org/13880029/ with fixes.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21934 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-24 09:26:58 +00:00
ajohnsen@google.com 60946b53fc Revert "Add new InternetAddress class with a static lookup function (including IPv6 results)."
Revert "Attempt to fix strict align issue."
Revert "Trying another fix."

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21928 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-24 08:10:00 +00:00
ajohnsen@google.com 20d1f5ddda Add new InternetAddress class with a static lookup function (including IPv6 results).
Reapply of https://codereview.chromium.org/14083007/ with fixes.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21923 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-24 07:12:05 +00:00
sgjesse@google.com afcb3ce69e Revert "Add new InternetAddress class with a static lookup function (including IPv6 results)"
TBR=ajohnsen@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21865 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-23 10:07:03 +00:00
ajohnsen@google.com b33d142414 Add new InternetAddress class with a static lookup function (including IPv6 results).
Socket.connect/ServerSocket.bind now accepts IPv6 host names. If a new ServerSocket is connected to an IPv6 interface, it will (if possible) support incoming IPv4 connections as well.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21862 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-23 09:36:18 +00:00
sgjesse@google.com efcd056ebe Support upgrading sockets to secure sockets
This build on the support for upgrading raw sockets to raw secure sockets.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21859 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-23 06:50:59 +00:00
sgjesse@google.com e1aa202b58 Add the ability to secure an already established raw socket connection
The static methods secure and secureServer can be used to start
TLS handshake as eihter client or server.

This CL only implement the securing of RawSocket.

This also changes the semantics of cancelling a subscription on a
RawSocket from closing the socket to just pausing.

R=ager@google.com

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21719 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-19 07:37:37 +00:00
floitsch@google.com 466d6670c1 Refactor Future constructors.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21517 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-15 21:24:27 +00:00
floitsch@google.com 5431a5af54 Remove AsyncError with Expando.
Review URL: https://codereview.chromium.org//14251006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21498 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-15 18:58:32 +00:00
floitsch@google.com f553392322 Change StreamController constructor.
Review URL: https://codereview.chromium.org//14196003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21472 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-15 16:34:26 +00:00
floitsch@google.com e2ee353940 Rename unsubscribeOnError to cancelOnError.
Review URL: https://codereview.chromium.org//14251013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21469 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-15 16:07:36 +00:00
ajohnsen@google.com b4eacbf8aa Rename RandomAccessFile.readList and RandomAccessFile.writeList to RandomAccessFile.readInto and RandomAccessFile.writeFrom.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21466 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-15 15:44:41 +00:00
ajohnsen@google.com 67650cb16e Remove .writeStream, .consume and rewrite IOSink to correctly implement a (sane) well-defined behaviour of the .done future.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21416 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-15 07:35:45 +00:00
floitsch@google.com 285849c801 Change hasSubscribers to hasListener.
Review URL: https://codereview.chromium.org//14103010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21337 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-12 09:30:05 +00:00
floitsch@google.com 134302aa48 Remove second generic argument of StreamConsumer.
Review URL: https://codereview.chromium.org//14172013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21303 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-11 18:11:40 +00:00
ajohnsen@google.com dcaf52732e Remove StreamSink(replaced by EventSink) and make IOSink extend EventSink.
With this change 'writeBytes' was renamed to 'add'.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21275 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-11 12:54:19 +00:00
ajohnsen@google.com 140409a05a Wrap stdout/stderr/stdin to only expose the relevant methods.
BUG=https://code.google.com/p/dart/issues/detail?id=9439,https://code.google.com/p/dart/issues/detail?id=9593

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21063 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-08 12:13:03 +00:00
floitsch@google.com e72250e49b StreamConsumer has an addStream and a close functions.
The 'consume' function will be removed.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20979 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-05 16:22:11 +00:00
floitsch@google.com f85fa4feff Make argument to StringSink.writeln optional.
BUG= http://dartbug.com/9102

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20074 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-15 12:45:40 +00:00
ajohnsen@google.com fb53f40e65 Add setOption method on Socket/RawSocket.
This will allow the user to enable TCP_NODELAY on the native sockets.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20014 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-14 12:46:54 +00:00
sgjesse@google.com a429f3aa83 Fix checked mode error on socket IOSink
The set encoding method on a Sockets IOSink implementation failed in
checked mode. Added a test calling all IOSink methods on a socket.

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

R=ajohnsen@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19803 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-11 16:15:56 +00:00
lrn@google.com bead146749 Renamed StreamSink to EventSink. Renamed signalError to addError.
Review URL: https://codereview.chromium.org//12610006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19683 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-08 11:31:19 +00:00