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
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
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
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
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
- Use only one thread to wait for multiple process objects.
- Fix issue where reading from a closed pipe would print an
error message on stderr.
- Remove the need to go to dart before removing a processinfo
object from the list. Sometimes you never get there so we
have to remove the process info object always.
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9310053
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3844 260f80e4-7a28-3924-810f-c04153c831b5
Create handle objects for stdin/stdout/stderr. For Mac OS and
Linus the file descriptor numbers are used but on Windows the
handles are wrapped in an object.
The system handles for stdin/stdout/stderr on Windows does not
support overlapped IO. To mittigate this the write calls are
performed synchronously and the read calls are preformed in a
thread which posts the result through the completion potr where
it is handled as if it originated from overlapped IO through the
completion port. For now each call to read starts a new thread.
R=ager@google.com
BUG=
TEST=
Review URL: http://codereview.chromium.org//8574002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1533 260f80e4-7a28-3924-810f-c04153c831b5
The handling of async IO on Windows wrongly casted everything to a socket connection. For named pipe based connections this caused reading of invalid memory.
Moved some of the functions to a common superclass and only call showdown for socket connections. For named pipe based connections the Dart part of the code will never send shutdown commands as named pipe based connections start out being closed in one direction and closing the other direction causes a close command.
R=ager@google.com
BUG=dart:363
TEST=
Review URL: http://codereview.chromium.org//8503006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1308 260f80e4-7a28-3924-810f-c04153c831b5
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