Commit Graph

50 Commits

Author SHA1 Message Date
ager@google.com 501a0dd907 Add test that passes invalid arguments to socket methods and fix
issues encountered.

The fuzzing is not as systematic as for some of the other
APIs. However, a lot of checking is going on in the Dart code so
forcing issues required a bit of work making objects act like lists
and integers.

Additionally, fix a memory leak in process implementation.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8088 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-30 08:17:25 +00:00
ager@google.com 379695ee2b Implement File.lastModified.
R=sgjesse@google.com,ajohnsen@google.com
BUG=dartbug/2988
TEST=standalone/io/file*

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7945 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-24 13:10:02 +00:00
sgjesse@google.com 3e33c89b62 Fix error reporting for socket write failure
It now includes the OS error in the thrown exception

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7365 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-07 07:44:33 +00:00
cshapiro@google.com 1472427af8 Revert "Revert "Implement {Int,Uint}{8,16,32,64} and Float{32,64} typed arrays.""
This reverts commit 63480a81fccbde001494dd535cd06a8fa02ed261.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7352 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-04 23:16:09 +00:00
sgjesse@google.com 33565cd64a Change the error handling in dart:io
1. Change the argument on all onError handlers from Exception to
Dynamic

2. Throw an exception if an error ocours and there is no error handler
present for handling it.

For sockets there is the complication that an error on a socket is
reported to the socket error handler, and each of the stream error
handlers. The solution to this is to throw an exception if there was
no error handler on either the socket or one of the streams.

Fixed a number of bugs in tests revealed by errors no longer being
silently ignored.

R=ager@google.com

BUG=none
TEST=tests/standalone/src/io/*

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6994 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-26 08:12:17 +00:00
hausner@google.com e74cd5fc3a Static members are not visible in subclasses
Fix for issue 1598.

Lexical scope comes before inherited names. Also, Static members
are not inherited and are not visible in subclasses.
Code in the subclass (or any other code for that matter) has to
qualify the names of these members with the class name.

We had a few tests that were wrong and only passed in the VM because
this was not implemented correctly.

Also had to fix code in frog and dartdoc.

I hope I ran enough tests. I built an all.deps tree using tools/build.py from the root directory, which brought up the frog and dartdoc issues.

Tested:
tools/test.py --compiler=dart2js --runtime=drt
tools/test.py -c none -r drt
tools/test.py -c frog -r drt
tools/test.py -r vm

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6698 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-18 16:09:22 +00:00
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
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 7fa9f1fe88 Add error handling to socket streams
Change the streams onError callbacks to get an Exception argument on
all streams.

Added actual error handling to the socket streams.

As it is difficult to determine where an error should be reported I
decided to call all the registered onError callbacks, that is on the
socket itself and on both input and output stream.

Did some additional cleanup of the naming of OnError argument in some tests.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5717 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-21 14:40:15 +00:00
sgjesse@google.com 57a9175636 Fix checked mode errors
Remove return types from functions which can now return objects of different types.

TBR=ngeoffray@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5711 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-21 10:37:50 +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
whesse@google.com d51bb2b427 Fix some minor static type issues in dart:io implementation.
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5514 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-15 09:34:51 +00:00
sgjesse@google.com 086c1f0c3a Handle closing of HTTP client and server
For the server keep track of the state of the connection and close the
socket when it is closed by the client. The client might close the
connection both when processing a request and while the connection is
an idle keep alive connection.

For the client keep track of the active connections as well as the
idle keep alive connections. When the client is closed make sure to
close all connections.

R=ajohnsen@google.com

BUG=none
TEST=tests/standalone/src/io/HttpShutdownTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4932 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-05 07:06:37 +00:00
ager@google.com 242bba108b Reapply dart:io API changes.
R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4790 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-01 10:07:35 +00:00
ager@google.com fd31551ca4 Revert "Rename blahHandler to onBlah throughout dart:io."
D'oh! I need to update the test binaries as well. Reverting, building
and putting back in again.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4785 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-01 09:43:15 +00:00
ager@google.com 40e0bceab5 Rename blahHandler to onBlah throughout dart:io.
Additionally, change all single-shot methods to take their callback as an argument instead of registering it on the object.

I have attempted to find all uses in the repo but there might
be some firefighting to do when this lands.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4784 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-01 09:36:04 +00:00
sgjesse@google.com b4d571dcdd Handle stdio redirection in standalone VM
The recent change to epoll on Linux and kqueue on Mac OS for getting
notifications from file descriptors caused the redirection of stdin,
stdout and stderr for the stand alone VM to stop working.

On Linux epoll failed when file descriptor 0, 1 or 2 redirected from
or to a file war registered. On Mac OS there was just no events
generated from kqueue.

The streams created for stdio, stdout and stderr is now of the correct
type and for file redirections no longer a socket object holding a
file descriptor for a regular file.

Added testing of stdio redirection using both pipes and files. These
tests are currently skipped on Windows.

Fixed handlin of short socket read when reading the process exit code.

Always close the socket port when not waiting for any events.

R=iposva@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4226 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-14 15:20:27 +00:00
ager@google.com ac5c191683 Another attempt at fixing the Socket tests.
The tests did not wait for the server isolate to finish before
exiting the main isolate.

The tests did not correctly count the number of bytes received on
the server-side. We have to count bytes per connection.

There were issues with close handlers being confused for timeouts.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4127 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-10 11:00:15 +00:00
ager@google.com aaed22d42e Revert "Fix potential flakiness of SocketStreamCloseTest."
R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4120 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-10 07:06:18 +00:00
ager@google.com 4b2bfef991 Fix potential flakiness of SocketStreamCloseTest.
Not reading out all 5 bytes before moving on.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4119 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-10 06:57:37 +00:00
sgjesse@google.com 4e9686dc4b Implemented encoding af a Dart_CMessage structure into a Dart message. Currently supported types are:
Boolean
  Smi
  Double
  String
  Array

The encoding uses the upper bits of the Dart_CObject type field for "marking" already written objects with their object id for generating backward references. After serialization these mark are removed.

Added the API Dart_PostCMessage for encoding and posting a Dart_CMessage structure.

Removed the API Dart_PostIntArray and used Dart_PostCMessage instead.

R=asive@google.com,turnidge@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3947 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-06 15:42:15 +00:00
ajohnsen@google.com 143de9eb80 Use ByteArray's native for Socket and File.
Review URL: https://chromiumcodereview.appspot.com//9235067

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3812 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-01 21:48:27 +00:00
ager@google.com 4605b5ea33 Minor changes to the dart:io library files.
- Split some of the streams into an interface and an implementation file.
- Add documentation comments where missing.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3616 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-26 10:03:19 +00:00
ager@google.com c46939aa66 Comment and white-space cleanup in IO libraries.
- use dart doc comment for interface comments.
- use '//' style comments for non-doc comments.
- remove some whitespace.

R=whesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3554 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-24 15:39:58 +00:00
sgjesse@google.com 59bf2982c2 Make sure to use an ObjectArray when writing to a socket
This improves performance of the native code accessing the data in the
supplied buffer when it is no already an ObjectArray.

The code is duplicated as refactoring into a separate function was not
feasible.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3428 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-19 08:49:30 +00:00
sgjesse@google.com 0010d34ced Fix checked mode failure
TBR=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2895 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-02 13:10:48 +00:00
sgjesse@google.com 8055ffeb77 Add close to input stream and cleanup socket and streams
* All input streams now have a close method for just cutting
  the stream
* Removed interfaces FileInputStream and FileOutputStream
* Added exceptions to socket to avoid mixing stream and non-stream
  use of the same socket
* Added special handling of the socket connect handler callback

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2893 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-02 13:00:59 +00:00
ager@google.com a7e26a2575 Fix HTTP sample implementation to actually wait for connections before attempting to write.
R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1971 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-01 11:44:29 +00:00
sgjesse@google.com 286d5dff90 Change handling of accepting socket connections
The accept method have been removed from the ServerSocket class and
the signature for the connectionHandler callback have been changed to
provide the accepted socket as an argument.

This is to avoid the possibility for accept to return null even in the
case of pending connection. This could happen if an error like EAGAIN,
EWOULDBLOCK and EINTR was returned by it OS accept call and previously
there was no way of propagating this without returning null from the
Dart call to accept.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1889 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-29 12:02:01 +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 5950638350 Better handling of stdin/stdout/stderr
When using stdout/stderr it is no longer necessary to explicitly
close the streams for the program to terminate. The automatic
close is handled by always closing the associated receive port
for write only streams when not waiting for any events. If a
close or error handler is installed for stdout/stderr these will
still keep the program alive.

For stdin better handling of the difference between sockets and
pipes have been immplemented. As a special case for stdin when
reading from a terminal the a POLLIN signal with 0 available
bytes is treated as end-of-file. This will trigger when pressing
ctrl-d in a terminal as POLLHUP is not set in that situation.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1507 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-14 14:47:58 +00:00
sgjesse@google.com 38b2b0d5d8 Provide access to stdin, stdout and stderr
R=ager@google.com, iposva@google.com

BUG=dart:402
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1456 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-11 11:45:53 +00:00
sgjesse@google.com 6efd258f7c Set closed for read state on a socket when indicated by the system
Without setting this state sockets would not always be closed
automatically when the input stream is read to the end and the output
stream is closed.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1406 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-10 16:35:55 +00:00
ager@google.com 0a03298fea Fix hang when opening sockets on ports that are not available.
Fix TimeoutTest to use free ports instead of using the same port
always. This does not work because tests are run in parallel and
we can have more than one instance of TimeoutTest running.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1310 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-08 13:26:51 +00:00
sgjesse@google.com 516d71ab0b Change the handling of closing sockets
Sockets now supports being half-closed for either reading or writing. When a socket is closed it is by default closed for both read and write and the underlying file descriptor is destroyed. However the socket close can be asked to only half-close the socket to send end of stream to the other end and still have the ability to receive more data.

The close event on a socket is only emitted when the socket is closed by the other end. Both half-close and full-close by the other end is reported as a close event. If a socket is already half closed the close event will automatically destroy the socket.

The streams on the sockets also takes advantage of this. A socket input stream will report a close event when the other end closed. A socket output stream will half-close the socket when close is called making it possible to still receive data on the input stream. When both streams have been closed the socket is destroyed.

For sockets operating on pipes they are initially created as half-closed for either reading or writing depending on which type of pipe a socket object is based on. A pipe for writing will start half-closed for reading so if it is only half-closed for writing the socket will still be destroyed. Same with a pipe for reading that will start half-closed for writing and when a close event is received half-closing the other direction will destroy the socket. Socket objects based on pipes are only exposed through streams.

Extended the socket close test to test a number of different scenarios.

Also refactor the socket data C++ object to encapsulate more socket information and operations.

Now the Linux and Mac OS versions are 100% the same as it turned out that using POLLRDHUP on Linux was not required any more.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1196 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-04 12:34:43 +00:00
ager@google.com 362d04f9af Consistently use setters to set event handlers in native APIs.
R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1083 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-02 12:12:43 +00:00
sgjesse@google.com 18e5ef8da5 New OutputStream interface
R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@997 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-01 10:10:37 +00:00
sgjesse@google.com 6568436be7 Explicitly handle listen sockets and connection sockets differently in Linux and Mac OS eventhandler
Previously the assumption was that an POLLIN event with no data available was from a listen socket with pending accepts. However a POLLIN event from a connection socket can have no data available if the data has been read before the event is processed.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@878 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-28 09:30:42 +00:00
srdjan@google.com 959f4b519d Use strict equality when comparing with null, especially when null is a default value.
Review URL: http://codereview.chromium.org//8400038

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@859 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-27 22:11:16 +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
sgjesse@google.com 500a14c6d5 Only call the dataReceived callback for sockets if there is actually data available
R=ager@google.com

BUG=
TEST=EchoServerStreamTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@809 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-27 10:08:08 +00:00
sgjesse@google.com 00a00bcdb4 This contains a new InputStream and StringInputStream interfaces.
The readUntil is only supported through readLine on the StringInputStream.

The StringInputStream implementation in string_stream.dart could live outside the VM as it is plain Dart code.

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@747 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-26 13:17:28 +00:00
sgjesse@google.com 786aee238a Fix the handling of exceptions from process start
The privious change in r389 where the sockets used to communicate with the chile process did not work. Even though the Socket objects are not assigned any file descriptor they should still have their Dart port closed. If not the VM will not terminate.

TBR=ager@google.com

TEST=ProcessStartExceptionTest.dart
BUG=none

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@395 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-13 13:31:51 +00:00
sgjesse@google.com 6abaad8aa1 Restructured socket tests and fixed readUntil on InputStream
Most of the socket tests where written with closing both the server and client ends of the socket. However on Windows this can lead to errors once in a while (WSAECONNRESET). The tests now closes the socket in the client and and waits for a close event on the server side.

The readUntil on InputStream did not take data in the internal buffer into account. This has been fixed and the related test have been rewritten to check for two patterns which together will match all the input.

R=ager@google.com

BUG=
TEST=

Review URL: https://chromereviews.googleplex.com/3536016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@126 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-06 14:47:49 +00:00
sgjesse@google.com cc0ffa0766 Minor changes to Socket and File
* align the definition of the exception class with how ProcessException ended up
* add constants for redability

R=ager@google.com

BUG=
TEST=

Review URL: https://chromereviews.googleplex.com/3551012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@98 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-06 07:57:34 +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