Commit Graph

172 Commits

Author SHA1 Message Date
Ben Konyi 0386f7ab6f Reverting until bots clear up.
Revert "Pulled a significant portion of Socket implementation into BaseSocket in order to prepare for the synchronous socket impementations which will also use these common methods."

This reverts commit 0422920142.

Revert "Updated incorrect call to Write in process_win.cc"

This reverts commit 9e1435148b.

Revert "Fixed incorrect call to Write from process_win.cc"

This reverts commit 11dcab2bed3c9ec8ec76bc200206ac202a4a5681.

Fixed incorrect call to Write from process_win.cc

BUG=

Review-Url: https://codereview.chromium.org/2791163004 .
2017-04-03 17:25:47 -07:00
Ben Konyi 0422920142 Pulled a significant portion of Socket implementation into BaseSocket in order to prepare for the synchronous socket impementations which will also use these common methods.
BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2780063002 .
2017-04-03 17:05:11 -07:00
Jacob Richman 4360e99d18 Revert "Fix observatory tests broken by running dartfmt."
This reverts commit b1f7e6d94673b098c93c187fe3efc45c15f27edc.

BUG=

Committed: https://github.com/dart-lang/sdk/commit/62be0eacfbb36bdc92a05c7c35bb4506621b6a3a
Review-Url: https://codereview.chromium.org/2767533002 .
2017-03-21 10:07:26 -07:00
Jacob Richman 62be0eacfb Revert "Fix observatory tests broken by running dartfmt."
This reverts commit b1f7e6d94673b098c93c187fe3efc45c15f27edc.

BUG=

Review-Url: https://codereview.chromium.org/2767533002 .
2017-03-20 22:19:22 -07:00
Jacob Richman 88f8aacd5f Re-apply rolled back CL to apply dartfmt to runtime.
Fix observatory tests broken by running dartfmt due to line and column changes.
Temporarily reverted formatting for evaluate_activation_test.dart as dartfmt doesn't yet handle multitests.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2759973004 .
2017-03-20 21:44:59 -07:00
Ryan Macnak ea4744a06f Revert "Run dartfmt on all files under runtime."
This reverts commit 15f393f189.

The change caused many service test failures due to changed line numbers.

TBR=jacobr@google.com

Review-Url: https://codereview.chromium.org/2762583003 .
2017-03-20 13:42:55 -07:00
Jacob Richman 15f393f189 Run dartfmt on all files under runtime.
I've omitted files where the formatter output is significantly uglier
than the original code and I'll send those files in a separate CL
with options for how to make the code look reasonable while still
taking advantage of the formatter.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2751423005 .
2017-03-20 13:13:50 -07:00
Vyacheslav Egorov f746f27870 Fix issues in dart:io implementation found by fasta.
R=kustermann@google.com
BUG=https://github.com/dart-lang/sdk/issues/28882

Review-Url: https://codereview.chromium.org/2718673002 .
2017-02-24 12:19:55 +01:00
Peter von der Ahé 00bed94e0c Fix various nits in VM patch files.
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2705593002 .
2017-02-17 16:28:57 +01:00
Zachary Anderson deb2181067 Don't clobber SocketError's OSError on failed write and send.
related #25342

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2632543002 .
2017-01-12 15:51:45 -08:00
Zachary Anderson 16db33b7a2 Propagate errors correctly in Socket.connect
socket.port can throw an exception. The error from the
exception, if there is one, has to go to the completer,
not be thrown up the stack, otherwise it may go to the
enclosing Zone rather than e.g. a try ... catch around
await Socket.connetc().

This is a possible fix for the issue below, but it is
tough to say because I don't have a reliable repro.

related #27440

R=asiva@google.com

Review URL: https://codereview.chromium.org/2426413006 .
2016-10-19 15:12:59 -07:00
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