Commit Graph

211 Commits

Author SHA1 Message Date
Zachary Anderson a76aa4e70c Throw an ArgumentError if the port is out of range
fixes #27416

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2361373003 .
2016-09-23 11:12:54 -07:00
Matthias Hausner 1a6d1eca32 Implement @patch annotation for patch class members
Allow members of patch classes to be annotated with @patch. The VM
ignores the annotation. I simply replaces the original method
if the name matches, or reports an error if field names match.

Adding a bit is_patched to members to do more checking remains a
TODO. There are currently no unused bits available, and I don’t want
to increase the size of Function objects for this.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2230383003 .
2016-08-10 12:54:57 -07:00
Matthias Hausner e11ca24053 Use metadata annotation @patch for patch classes
Annotate patch classes and top-level patch functions with @patch
instead of the pseudo-keyword patch. This allows the analyzer
to read patch files, and matches the syntax that dart2js uses.

The deprecated syntax is still supported, but a warning is printed when detected.

BUG=

Review URL: https://codereview.chromium.org/2220883004 .
2016-08-09 09:48:03 -07:00
Florian Loitsch 596723f0c3 Fix return type for JoinMulticast.
Fixes #27032.

BUG= http://dartbug.com/27032
R=sgjesse@google.com

Review URL: https://codereview.chromium.org/2220983002 .
2016-08-08 12:22:30 +02:00
Florian Loitsch ef4933df25 Better error-message when bind fails.
See #26790.

R=sgjesse@google.com

Committed: https://github.com/dart-lang/sdk/commit/34aed6a08b8547a985ac701cf3910a5f5450dd52

Reverted: https://github.com/dart-lang/sdk/commit/a1005bad7e249a5510b30683a5ca52b16baafbc4

Committed: https://github.com/dart-lang/sdk/commit/8c4954492f0593f41d270691bb82c26d8509c894

Reverted: https://github.com/dart-lang/sdk/commit/5ebcd3cda0f34be580be1a8ed816849a82691427

Committed: https://github.com/dart-lang/sdk/commit/eaeb260244d524b54d3ec842af2f8400cd543b12

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

Reverted: https://github.com/dart-lang/sdk/commit/90a194be3c03c058c4e087e1bd11823817982393
2016-08-04 14:45:01 +02:00
Florian Loitsch 90a194be3c Enter a description of the change.
Merge branch 'master' into revert

Revert "Better error-message when bind fails."

This reverts commit eaeb260244.

Review URL: https://codereview.chromium.org/2213533002 .
2016-08-03 23:18:39 +02:00
Florian Loitsch eaeb260244 Better error-message when bind fails.
See #26790.

R=sgjesse@google.com

Committed: https://github.com/dart-lang/sdk/commit/34aed6a08b8547a985ac701cf3910a5f5450dd52

Reverted: https://github.com/dart-lang/sdk/commit/a1005bad7e249a5510b30683a5ca52b16baafbc4

Committed: https://github.com/dart-lang/sdk/commit/8c4954492f0593f41d270691bb82c26d8509c894

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

Reverted: https://github.com/dart-lang/sdk/commit/5ebcd3cda0f34be580be1a8ed816849a82691427
2016-08-03 22:44:28 +02:00
Ryan Macnak 5ebcd3cda0 Revert "Better error-message when bind fails."
This reverts commit 8c4954492f.

This change broke the Android build.

Review URL: https://codereview.chromium.org/2201183004 .
2016-08-03 09:54:57 -07:00
Florian Loitsch 8c4954492f Better error-message when bind fails.
See #26790.

R=sgjesse@google.com

Committed: https://github.com/dart-lang/sdk/commit/34aed6a08b8547a985ac701cf3910a5f5450dd52

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

Reverted: https://github.com/dart-lang/sdk/commit/a1005bad7e249a5510b30683a5ca52b16baafbc4
2016-08-03 16:27:48 +02:00
Florian Loitsch a1005bad7e Revert "Better error-message when bind fails."
This reverts commit 34aed6a08b.

Review URL: https://codereview.chromium.org/2210523002 .
2016-08-03 15:47:15 +02:00
Florian Loitsch 34aed6a08b Better error-message when bind fails.
See #26790.

R=sgjesse@google.com

Review URL: https://codereview.chromium.org/2205913003 .
2016-08-03 15:29:41 +02:00
Florian Loitsch e3c3f099ea Fix strong mode errors in dart:io.
Still a lot of strong mode warnings left.

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

Committed: https://github.com/dart-lang/sdk/commit/5216f1d67d09d289f7c7ceab56a64ce0dcb7d563

Reverted: https://github.com/dart-lang/sdk/commit/7503ecc8fdb32747b2b05b529219ce83da8f0b6c

Review URL: https://codereview.chromium.org/1904553006 .
2016-05-12 13:17:31 +02:00
Florian Loitsch 7503ecc8fd Revert "Fix strong mode errors in dart:io."
This reverts commit 5216f1d67d.

BUG=

Review URL: https://codereview.chromium.org/1966373002 .
2016-05-11 21:44:09 +02:00
Florian Loitsch 5216f1d67d Fix strong mode errors in dart:io.
Still a lot of strong mode warnings left.

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

Review URL: https://codereview.chromium.org/1904553006 .
2016-05-11 14:30:32 +02:00
Zachary Anderson ba550f1c43 Fixes NetworkInterface.list crash on Android
Previously, Socket::ListInterfaces failed to set the os_error out
parameter causing a crash in the caller. This change sets an error here.

I've also added NetworkInterface.listSupported, which returns false on
Android, and true everywhere else. ifaddrs.h continues not to exist in
the NDK, so in order to support NetworkInterface.list, we'd have to
reimplement it, or find a suitable reimplementation somewhere.

related #26329

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1916223003 .
2016-04-26 07:48:58 -07:00
Søren Gjesse 9431f0b32c Fix Mac OS check for terminal input
Closes #25862
BUG= https://github.com/dart-lang/sdk/issues/25862

TBR=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1760033003 .
2016-03-03 10:40:12 +01:00
John McCutchan b9b0649b9c dart:developer service extension fixes
Fixes #25724
Fixes Florian Loitsch's emailed request (get rid of k prefix on constants).

- Rename ServiceExtensionResponse constants to not have a 'k' prefix.
- Provide more explanation on how to invoke service extensions (they require an 'isolateId' parameter).
- Require extension method names to begin with "ext." and recommend the template: "ext.package.command" to avoid conflicts with other packages.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1680593004 .
2016-02-10 08:54:51 -08:00
Søren Gjesse 65872873d2 Remove server socket references
The use of server socket references was deprecated in 1.9 and marked
for removal in 1.10.

R=kustermann@google.com

BUG=http://dartbug.com/22187

Review URL: https://codereview.chromium.org/1072783003 .
2015-10-05 12:25:20 +02:00
Rico Wind c6918fb126 Refactor the io resource classes
Move stopwatch so that we will only ever need one instance

Add utility functions for doing reads and writes

The only functional change here is that I say that an except is a read
of one byte, which also updates the readcount. I think this is just as
correct as what we did before.

BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1320023008 .
2015-09-09 09:18:07 +02:00
Rico Wind 06ab2bdbdd Extract meta data about open sockets into separate class.
The current implementation only has information about tcp and udp
sockets, and we explicitly do not track internal and pipe uses of
_NativeSockets.

The testing of this is done through the service layer, which is the end user of
this.

BUG=
R=sgjesse@google.com

Committed: https://github.com/dart-lang/sdk/commit/01eff8ce18be7eceb6ce0be1097005965edf2588

Review URL: https://codereview.chromium.org//1323943003 .
2015-09-03 19:18:42 +02:00
Rico Wind 665f397bb8 Revert "Extract meta data about open sockets into separate class."
This reverts commit 01eff8ce18.

Seeing issues on windows and on dart2js

R=sgjesse@google.com
BUG=

Review URL: https://codereview.chromium.org//1323183002 .
2015-09-02 16:18:52 +02:00
Rico Wind 01eff8ce18 Extract meta data about open sockets into separate class.
The current implementation only has information about tcp and udp
sockets, and we explicitly do not track internal and pipe uses of
_NativeSockets.

The testing of this is done through the service layer, which is the end user of
this.

BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1323943003 .
2015-09-02 15:26:35 +02:00
sgjesse@google.com 48584debbd Make Socket address and port getters available after the socket is closed
There getters are used for generating eddor messages.

TBR=ajohnsen@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44359 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-10 08:54:22 +00:00
sgjesse@google.com 1d808d071b Fixed a number of bugs on RawSocket and Socket
The checking of the closed state was not present when dealing
with the properties port, remotePort, address and remoteAddress
on RawSocket and Socket. Then now all throw SocketException when
the RawSocket or Socket is closed.

* Calling port on a RawSocket would return the port even if it
  was closed

* Calling remotePort, address and remoteAddress did not check for
  OSError

* Calling remotePort, address and remoteAddress on a closed
  RawSocket caused syscalls using the already closed fd, which
  might also have been re-allocated already.

* Calling port, remotePort, address and remoteAddress on a closed
  Socket caused null pointer exception

R=ajohnsen@google.com

Correctly check for errors when getting remote address and port

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44319 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-09 13:33:28 +00:00
whesse@google.com 1d928984a3 Recommit "Fix issues with Socket shutdown.""
This recommits revision r44178, which was reverted in r44180, with changes to
fix the issues with Process.stdin.  It also adds a test for issue 22636, duplicate READ_CLOSED message.

Changes from r44187
Test tests/standalone/io/issue_22636_test.dart added.
Line "native.closedReadEventSent = true;" added to _RawSocket._writePipe() in runtime/bin/socket_patch.dart.

BUG=http://dartbug.com/22636
BUG=http://dartbug.com/22637
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44236 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-04 14:37:34 +00:00
whesse@google.com bbfd19ca02 Revert "Fix issues with Socket shutdown."
This reverts commit r44178, because it makes 10 tests about process stderr
and stdin fail with timeouts.
Original CL: https://codereview.chromium.org/975723002/

BUG=dartbug.com/22637
BUG=dartbug.com/22636
R=kustermann@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44180 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 16:51:57 +00:00
whesse@google.com 7d15c8182a Fix issues with Socket shutdown.
BUG=dartbug.com/22637
BUG=dartbug.com/22636

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44178 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 16:19:23 +00:00
kustermann@google.com 615d1a01ac Reland "Introduce optional 'bool shared' parameter to ServerSocket.bind() ..."
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43678 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-11 10:01:20 +00:00
sgjesse@google.com 7b7ac3620a Add support to specify the source address for socket connect
BUG=http://dartbug.com/22253
R=kustermann@google.com, lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43638 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-10 11:56:51 +00:00
kustermann@google.com 3ea331e741 Introduce a kSetEventMaskCommand, some cleanups in windows eventhandler
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43547 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-06 09:36:57 +00:00
kustermann@google.com 1d6231bacd Revert "Introduce optional 'bool shared' parameter to ServerSocket.bind() ..."
Review URL: https://codereview.chromium.org//896213002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43476 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-04 16:00:21 +00:00
kustermann@google.com 3c6c29fee9 Introduce optional 'bool shared' parameter to ServerSocket.bind() ...
R=sgjesse@google.com, wibling@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43467 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-04 13:41:41 +00:00
rmacnak@google.com 2fb0bb020b Reapply "Mark all private functions in dart: libraries as invisible (*sniff*). Previously these functions were only marked invisible if they were also native, a constructor, or on a black list."
Broken assumption in Dartium fixed in blink r188698.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43053 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-21 20:44:04 +00:00
rmacnak@google.com ed88ac7f0c Revert "Mark all private functions in dart: libraries as invisible (*sniff*). Previously these functions were only marked invisible if they were also native, a constructor, or on a black list."
Broke Dartium.

TBR=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43026 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-20 20:56:59 +00:00
rmacnak@google.com 045bd762d7 Mark all private functions in dart: libraries as invisible (*sniff*). Previously these functions were only marked invisible if they were also native, a constructor, or on a black list.
An invisible function is hidden from stack traces, will not be enumerated
by mirrors, and cannot be directly invoked by mirrors. Note that private
classes remain accessible.

Fix a few internal dart:io functions that should be private.

Fix bug where mirrors would enumerate top-level invisible functions.

Mark observatory test that was using such private functions through
mirrors as failing.

BUG=http://dartbug.com/15274
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43019 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-20 18:32:19 +00:00
kustermann@google.com 360dfe4f41 Several bugfixes in dart:io's handing of sockets
This CL includes fixes for the following issues:

a) The event handler created listening socket metadata (values of a hashtable
indexed by filedescriptor) sometimes as SocketData and sometimes as
ListeningSocketData depending whether the socket has been listened to or not.
This was very buggy, in particular because multiple isolates can have a
reference to the same server socket in different states (opened, listened,
closed).

=> This should be fixed by sending the file descriptior typeMask always to the
   eventhandler.

b) A server socket cloned via the ServerSocketReference mechanism, opens a
receive port for sending (fd, address, port) to isolates/... which want to
create a server socket from the reference.
This receive port was not closed properly when calling only close() (and not
listening first).

=> This should be fixed by closing this receiveport on the ServerSocket.close()
   call as well.

c) It was assumed in the event handler that a close command needs to have the
Dart_Port in a hash table. But this is only the case if the user actually
listened to the ServerSocket. Otherwise the event handler does not know about
the server socket. This caused a NULL dereference which resulted in a SEGFAULT.

=> This should be fixed by checking if the Dart_Port is in the hashmap of the
ListeningSocketData or not.

d) Too many bits were considered when extracting token count in C++ code.

The CL includes a regression test which should trigger these issues.

BUG=21384,21383
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41276 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-24 08:55:50 +00:00
ajohnsen@google.com 1e731cf3e5 Don't create unused OSError in Socket_Available.
BUG=
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41005 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-09 06:21:21 +00:00
ajohnsen@google.com 9dd4df6f9a Fix datagram issue where available is not correctly updated upon receive.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40235 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-15 08:21:44 +00:00
ajohnsen@google.com 7ea3f05253 Clean up socket:connect change.
BUG=
R=sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38918 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-06 05:10:44 +00:00
ajohnsen@google.com 1984326985 In Socket:connect, start connecting to next address, after 250 (25 for loopback).
BUG=https://code.google.com/p/dart/issues/detail?id=19871
R=whesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38662 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-29 11:26:49 +00:00
asiva@google.com a2d7a425c9 - Remove Dart_ReceivePortGetId, Dart_GetReceivePort and Dart_PostMessage.
- Change _EventHandler._sendData to use a sendport object instead of a
  receiveport object.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37827 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-30 17:46:26 +00:00
ajohnsen@google.com 8719f3834b Add Observatory test of io.
Initially a single test of a HttpServer. More will follow.

This also fixes the case where we don't 'block' when binding to a
ServerSocket. We should not close until the socket is explicitly closed.

BUG=
R=johnmccutchan@google.com, sgjesse@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37164 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-10 07:13:52 +00:00
ajohnsen@google.com 8b612e8780 Add read/write stats to Socket and RandomAccessFile.
BUG=
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36738 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-28 13:29:51 +00:00
johnmccutchan@google.com f5d6c4106e Fix test breakage in socket_patch.dart
Review URL: https://codereview.chromium.org//307553008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36736 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-28 11:45:29 +00:00
johnmccutchan@google.com e46aa81943 Create a ServiceObject for a socket
R=ajohnsen@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36735 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-28 11:25:12 +00:00
johnmccutchan@google.com 1f62dad54d Add Proces owner of socket and fix printing of non-network sockets
R=ajohnsen@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36729 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-28 07:15:02 +00:00
ajohnsen@google.com 9c7979ed1f Add 'owner' field to sockets, that point to a potential IO resource using that Socket.
BUG=
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36680 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-27 14:10:31 +00:00
ajohnsen@google.com 217e8b8605 Add WebSockets to Observatory.
BUG=
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36667 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-27 11:37:51 +00:00
ajohnsen@google.com 3218f34433 Add 'Sockets' to observatory.
BUG=
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36650 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-27 07:49:47 +00:00
ajohnsen@google.com 44d8df4bb4 Add Socket ref to HttpServer.
BUG=
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36644 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-27 06:38:15 +00:00