sgjesse@google.com
4ca4f0db07
Only store the address bytes for an internet address in Dart
...
We used to store the full C "struct sockaddr_storage" in the Dart
internet address. Changed this to be only the bytes for the
address. This removes opaque platform specific binary data from Dart
(e.g. on Mac OS the "struct sockaddr" has an initial length byte).
R=ajohnsen@google.com
BUG=
Review URL: https://codereview.chromium.org//113923004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31191 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-17 15:35:11 +00:00
sgjesse@google.com
26a31f84fe
Fix malformed type in socket_patch.dart
...
TBR=ajohnsen@google.com
BUG=
Review URL: https://codereview.chromium.org//104783006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31102 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-12 16:24:56 +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
5621dbd99d
Don't report multiple read-closed events.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//96763004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30784 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-29 13:25:05 +00:00
sgjesse@google.com
bed6412143
Fix checked mode failure
...
TBR=ajohnsen@google.com
BUG=
Review URL: https://codereview.chromium.org//96413003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30781 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-29 12:01:26 +00:00
ajohnsen@google.com
458ccec72f
Fix socket to report write errors async.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//96203006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30777 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-29 11:19:57 +00:00
sgjesse@google.com
5ec3f666c0
Add the index information to network interface
...
R=ajohnsen@google.com
BUG=
Review URL: https://codereview.chromium.org//95183002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30776 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-29 11:18:30 +00:00
ajohnsen@google.com
5591751c3c
Add test of Zones for HttpServer and RawSocketServer.
...
BUG=https://code.google.com/p/dart/issues/detail?id=15367
R=floitsch@google.com , sgjesse@google.com
Review URL: https://codereview.chromium.org//93973002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30775 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-29 10:26:00 +00:00
ajohnsen@google.com
e60f22cb9e
Add support for Websocket protocols.
...
This also fixes an issue where idle sockets could keep the program
alive.
BUG=https://code.google.com/p/dart/issues/detail?id=14503
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//91223002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30712 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-27 12:10:23 +00:00
sgjesse@google.com
26f89dbd7f
Fix dart2js after InternetAddress change
...
R=ajohnsen@google.com , ngeoffray@google.com
BUG=
Review URL: https://codereview.chromium.org//78223002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30459 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-20 12:03:14 +00:00
sgjesse@google.com
32e6279482
Update InternetAddress
...
Add InternetAddress constructor for numeric addresses. An
InternetAddress can now be constructed without using DNS resolving.
Add hash code calculated from the bytes of the address.
Add equality operator comparing the bytes of the address.
Added check for multicast addresses.
R=ajohnsen@google.com
Review URL: https://codereview.chromium.org//76383002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30449 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-20 10:01:22 +00:00
sgjesse@google.com
09ef9104e0
Don't supply host names for the fixed internet addresses
...
The hard-coded host names "localhost" and "localhost-ip6" where taken
from the default Ubuntu hosts file. But other machines (e.g the
default on Mac OS) might be configured different. To avoid actual
lookup of "localhost" and "localhost-ip6" returning a different
address than the provided fixed loopback addresses don't add an actual
host name.
R=ajohnsen@google.com
BUG=
Review URL: https://codereview.chromium.org//76243002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30403 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-19 12:17:41 +00:00
ajohnsen@google.com
57d8b90fe1
Rename remoteHost to remoteAddress on *Socket.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//59213003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29904 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-05 13:24:49 +00:00
hausner@google.com
1b87d7e2bd
Compile time error on forward references to functions
...
Like variables, names of functions must not be referenced
before they are declared.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//49253006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29835 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-04 18:53:58 +00:00
ajohnsen@google.com
841785cbb3
Add IOSink:flush().
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//52263005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29550 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-30 14:50:22 +00:00
floitsch@google.com
6a72655d1b
Very simple version of Isolates.
...
R=ajohnsen@google.com , iposva@google.com , kasperl@google.com , lrn@google.com
Review URL: https://codereview.chromium.org//27215002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29271 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-25 19:23:00 +00:00
floitsch@google.com
0f7a0bd7b1
Rename runAsync to scheduleMicrotask.
...
R=lrn@google.com
Review URL: https://codereview.chromium.org//26151002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28569 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-12 15:52:17 +00:00
floitsch@google.com
4be547c705
Adapt streams for additional stackTrace argument.
...
R=lrn@google.com
Review URL: https://codereview.chromium.org//25094002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28511 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-11 12:02:20 +00:00
ajohnsen@google.com
031dcbe37b
Don't emit errors from the socket when we are closing it down.
...
The socket may be deleted at this point, so getting the error can be 'use-after-free'. Also, the actual error doesn't help, as the user can't do anything about a bad close (note that all data is 'flushed' before close is called).
BUG=https://code.google.com/p/dart/issues/detail?id=12982
R=whesse@google.com
Review URL: https://codereview.chromium.org//25276003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28053 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-30 14:56:42 +00:00
whesse@google.com
12cadfd1be
Add .address to [Raw]ServerSocket and HttpServer.
...
Also use .address in Pub's barback server.
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//25010004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28010 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-27 13:36:03 +00:00
ajohnsen@google.com
3e0a59b920
Clean up IOService implementation to be shared between patched and non-patched code.
...
BUG=
Review URL: https://codereview.chromium.org//24596003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27888 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-25 15:53:54 +00:00
ajohnsen@google.com
a347038cd7
Merge services into a shared IOService in dart:io, and use a native port.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//24395013
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27883 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-25 15:03:24 +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
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