Commit Graph

211 Commits

Author SHA1 Message Date
ajohnsen@google.com c7a15b7c2b Add support for cloning server-sockets.
BUG=
R=lrn@google.com, sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35818 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-06 19:09:44 +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 deccfaf042 Make Socket::connect try all addresses given.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35619 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-01 08:42:57 +00:00
ajohnsen@google.com 8f41c24471 Make server-sockets level triggered.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35302 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-23 06:05:46 +00:00
ajohnsen@google.com 94f53d4d2b Fix *ServerSocket's handling of zones.
A stream's zone is the one it has when listening to. Use that, and not
the one active when creating the socket.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35071 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-15 18:44:14 +00:00
ajohnsen@google.com 1a8f76beb3 Only return eventhandler tokens in stacks of 8, to avoid runtime calls.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34359 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-25 13:44:01 +00:00
ajohnsen@google.com 4cf3726fe6 Close(destroy) Socket on user-generated write error.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34109 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-19 09:23:17 +00:00
ajohnsen@google.com 0c157cd31e Move signal_blocker to platform and use it by default in TEMP_FAILURE_RETRY.
BUG=http://code.google.com/p/dart/issues/detail?id=16927
R=johnmccutchan@google.com, sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33745 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-17 13:51:11 +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
sgjesse@google.com 1e3e88769f Socket I/O statistics for Observatory
This is the first part of adding I/O statistics to the observatory.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33366 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-06 11:12:08 +00:00
ajohnsen@google.com ce266f9435 Merge all http-outgoing transfomers into _HttpOutgoing, including simpler(better) buffering.
This speeds up the system by:
- Using a simpler buffering mechanism, where we fill up a 8kb buffer, pass it on, and allocating a new.
- Avoiding up to 4 streams for each stream added to the http-outgoing. We now only create one extra stream.

BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33272 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-04 13:58:46 +00:00
ajohnsen@google.com fc5af7b7b4 Add InternetAddress:rawAddress, to return the raw address as a list of bytes.
BUG=https://code.google.com/p/dart/issues/detail?id=17137
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33235 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-03 18:33:56 +00:00
ajohnsen@google.com 9635777fe0 Don't try to call read, if len i 0.
Also fix a Socket_Read to handle -1 from read.

BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32849 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-20 12:23:20 +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 7e49953c19 Avoid over-use of futures in socket.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32571 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-11 19:14:05 +00:00
ajohnsen@google.com 5558bb0d1f Fix most UDP issues on Mac OS
We still do not test getting SO_BROADCAST, as it (at least on my laptop)
returns false even if it has just been turned on.

Setting SO_REUSEADDR for datagram sockets also behaves differently
compared to Linux and Windows.

IPv6 multicast as I could not test it on my laptop.

R=ajohnsen@google.com
BUG=http://dartbug.com/1975

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31223 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-18 12:23:40 +00:00
sgjesse@google.com 85fdbfb773 Add argument checking to InternetAddress constructor
R=ajohnsen@google.com
BUG=http://dartbug.com/15687

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31220 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-18 11:26:02 +00:00
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