Florian Schneider
fbdce6a59e
VM: Const-correctness fixes.
...
Three types of fixes:
1. Remove redundant const_cast
2. Remove const_cast by adding const when appropiate.
3. Remove const_cast by removing const (e.g. places where we call free with it)
For now I only fixed places where the fix is local enough - i.e. does not require
changed a large amount of code.
BUG=
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/1526123002 .
2015-12-15 19:24:40 +01: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
sgjesse@google.com
3fe2af43d1
Reafctor to use 'const RawAddr&' or 'RawAddr*' in the eventhandler code
...
Also pass the port as part of RawAddr instead of in a separate argument
when both addr and port are passed.
R=kustermann@google.com
BUG=
Review URL: https://codereview.chromium.org//910183003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43722 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-12 11:39:20 +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
sgjesse@google.com
91e7a32eb5
Remove SetNonBlocking/SetBlocking methods from Socket and add missing close-on-exec
...
The methods SetNonBlocking/SetBlocking on Sockets where not implemented on Linux
and not used on Windwsm. Removed and call directly to FDUtils when needed.
In Socket::Accept setting close on exec was missing on OS X and Android.
R=kustermann@google.com
BUG=
Review URL: https://codereview.chromium.org//907883002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43627 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-10 07:29:36 +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
iposva@google.com
14ecdbd66a
- Separate the thread implementation used in bin/ and vm/
...
to allow us to make VM specific changes.
R=asiva@google.com
Review URL: https://codereview.chromium.org//463993002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39172 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-12 23:19:53 +00:00
ajohnsen@google.com
d481c8b61c
Start accepting incoming sockets earlier on Windows, to associate a at AcceptEx error to 'ServerSocket.bind'.
...
Note that I have not been able to reproduce the error, thus no test is added for this case.
BUG=http://code.google.com/p/dart/issues/detail?id=19815
R=whesse@google.com
Review URL: https://codereview.chromium.org//426613002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38606 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-28 11:36:35 +00:00
iposva@google.com
1d2085e773
- Fix truncation in Socket calls.
...
R=asiva@google.com
Review URL: https://codereview.chromium.org//312343002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37037 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-05 17:33:52 +00:00
iposva@google.com
e1ec7a2c5f
- Update status file to mark crashing test while investigating.
...
- Remove unused fields from socket code.
R=asiva@google.com
Review URL: https://codereview.chromium.org//257433002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35346 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-24 00:37:55 +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
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
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
sgjesse@google.com
72d2ca28c9
Cleanup the getting and setting of the socket file descriptor
...
R=ajohnsen@google.com
Review URL: https://codereview.chromium.org//81013002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30524 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-21 15:22:35 +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
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
ajohnsen@google.com
33c74ee3d7
Remove usage of legacy inet_ntop from dart:io.
...
BUG=https://code.google.com/p/dart/issues/detail?id=13577
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//25411003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28090 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-01 11:27:46 +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
900dba8e03
Remove static mutexes/monitors from dart:io.
...
BUG=
R=whesse@google.com
Review URL: https://codereview.chromium.org//18080010
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24576 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-28 08:44:15 +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
johnmccutchan@google.com
9d264aaee5
Add support for loading scripts from http
...
R=iposva@google.com
Review URL: https://codereview.chromium.org//15966002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23351 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-29 14:34:15 +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
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
smok@google.com
ebbc2020a2
Put everything in runtime/bin into '::dart::bin' namespace.
...
Review URL: https://codereview.chromium.org//14341015
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22032 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-25 14:22:30 +00:00
sgjesse@google.com
d27309942c
Fix broken Mac OS socket code
...
The order of the fields in the sockaddr structures on Mac OS was different and we where relying on the Linux/Windows order of fields. This should now be platform independent.
TBR=ajohnsen@google.com
BUG=
Review URL: https://codereview.chromium.org//14139032
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21940 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-24 11:51:56 +00:00
ajohnsen@google.com
55963a1a6d
Add new InternetAddress class with a static lookup function (including IPv6
...
results).
Reapply of https://codereview.chromium.org/13880029/ with fixes.
BUG=
Review URL: https://codereview.chromium.org//14469002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21934 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-24 09:26:58 +00:00
ajohnsen@google.com
60946b53fc
Revert "Add new InternetAddress class with a static lookup function (including IPv6 results)."
...
Revert "Attempt to fix strict align issue."
Revert "Trying another fix."
BUG=
Review URL: https://codereview.chromium.org//14036017
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21928 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-24 08:10:00 +00:00
ajohnsen@google.com
81290b98ee
Trying another fix.
...
BUG=
Review URL: https://codereview.chromium.org//14389008
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21927 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-24 08:02:13 +00:00
ajohnsen@google.com
423025b20d
Attempt to fix strict align issue.
...
BUG=
Review URL: https://codereview.chromium.org//14217013
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21925 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-24 07:32:27 +00:00
ajohnsen@google.com
20d1f5ddda
Add new InternetAddress class with a static lookup function (including IPv6 results).
...
Reapply of https://codereview.chromium.org/14083007/ with fixes.
BUG=
Review URL: https://codereview.chromium.org//13880029
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21923 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-24 07:12:05 +00:00
sgjesse@google.com
afcb3ce69e
Revert "Add new InternetAddress class with a static lookup function (including IPv6 results)"
...
TBR=ajohnsen@google.com
Review URL: https://codereview.chromium.org//14081024
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21865 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-23 10:07:03 +00:00
ajohnsen@google.com
b33d142414
Add new InternetAddress class with a static lookup function (including IPv6 results).
...
Socket.connect/ServerSocket.bind now accepts IPv6 host names. If a new ServerSocket is connected to an IPv6 interface, it will (if possible) support incoming IPv4 connections as well.
BUG=
Review URL: https://codereview.chromium.org//14083007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21862 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-23 09:36:18 +00:00
ajohnsen@google.com
fb53f40e65
Add setOption method on Socket/RawSocket.
...
This will allow the user to enable TCP_NODELAY on the native sockets.
BUG=
Review URL: https://codereview.chromium.org//12614014
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20014 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-14 12:46:54 +00:00
tball@google.com
ca8b23183b
Added Socket::SetBlocking() and Socket::SetNonBlocking().
...
Review URL: https://codereview.chromium.org//12380032
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19334 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-01 18:33:17 +00:00
tball@google.com
898ec7731f
Added Socket::Close() function.
...
Review URL: https://codereview.chromium.org//12209047
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18199 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-07 00:44:55 +00:00
sgjesse@google.com
800b4b6c37
Add function for finding what a InputStream or OutputStream is attached to
...
For the dart:io types InputStream and OutputStream the top level
function stdioType will return whether the stream is attached to a
terminal, pipe, file or something else.
BUG=dart:2789
R=ager@google.com
Review URL: https://codereview.chromium.org//11773041
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16839 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-09 09:17:07 +00:00
ager@google.com
c6aea6b1eb
Use native wrapper fields to store socket ids.
...
This relies on landing the change to fix implicit super constructors
for subclasses of something that has native fields.
R=sgjesse@google.com
BUG=dartbug.com/5301
Review URL: https://codereview.chromium.org//10962012
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12684 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-21 08:19:01 +00:00
ajohnsen@google.com
0c17bf126c
Throw an error if the ServerSocket host argument is invalid.
...
BUG=
Review URL: https://chromiumcodereview.appspot.com//10917064
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11769 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-03 14:39:47 +00:00
jackpal@google.com
e060b66a3e
Add _android files for building DartVM on Android
...
Split directory_posix -> directory_(android|linux|macos)
This allows us to cleanly make Android-specific changes to
directory_android.cc
Copy all _linux files to _android files and edit as needed to account
for the differences between Linux and Android:
+ getcwd(0, NULL) doesn't work on Android, have to emulate
+ Android doesn't have a '/tmp' directory, have to emulate
+ Android doesn't provide mkdtemp(), have to emulate.
+ Small differences in the available system include files.
+ Use pthread_cond_timedwait_monotonic instead of
pthread_condattr_setclock
Review URL: https://chromiumcodereview.appspot.com//10826233
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10613 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-13 23:06:52 +00:00
asiva@google.com
2393f17f1a
Fix win32 Socket test errors
...
SocketInfoTest and SocketPortTest are failing on windows.
Review URL: https://chromiumcodereview.appspot.com//10014037
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6390 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-10 23:29:02 +00:00
ajohnsen@google.com
a4c350c17f
Fix signature of GetRemotePeer declaration.
...
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9999022
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6354 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-10 12:24:04 +00:00
ajohnsen@google.com
4ecf48b601
Add remoteHost to Socket.
...
This is merging the native calls into one, GetRemotePeer, thus
eliminating a potentiel extra call to getpeername.
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//10032027
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6353 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-10 12:18:12 +00:00
ajohnsen@google.com
1dd508bd44
Add remotePort getter to Socket.
...
Review URL: https://chromiumcodereview.appspot.com//9963053
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6090 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-02 13:54:03 +00:00
ager@google.com
1ffc9b84a2
Treat EAGAIN/EWOULDBLOCK as requests for retry on socket accept.
...
On Linux there are a number of protocol errors that can be
returned from accept. According to the linux man pages they
should be treated as EAGAIN.
This should hopefully fix the flakiness of EchoServerStreamTest.
R=iposva@google.com ,sgjesse@google.com
BUG=2262
TEST=
Review URL: https://chromiumcodereview.appspot.com//9837060
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5797 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-23 22:39:27 +00:00
sgjesse@google.com
0b3f4a1190
Extend dart:io error handling to all socket functions
...
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
2012-03-21 09:39:47 +00:00
sgjesse@google.com
168ae8c785
Start better error reporting for sockets
...
Changed the onError callback for sockets to take an exception argument.
First area to report errors for is name resolution.
Changed the IP address resolution from being synchronous with the
creation of the socket to being asynchronous thsough a lookup
service running on a native port. Currently this lookup service
is static on the socket class as we need to call it from a
factory method. We should probably add a separate name lookup
service at some point.
R=ager@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9699017
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5640 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-19 11:26:41 +00:00