For the server keep track of the state of the connection and close the
socket when it is closed by the client. The client might close the
connection both when processing a request and while the connection is
an idle keep alive connection.
For the client keep track of the active connections as well as the
idle keep alive connections. When the client is closed make sure to
close all connections.
R=ajohnsen@google.com
BUG=none
TEST=tests/standalone/src/io/HttpShutdownTest.dart
Review URL: https://chromiumcodereview.appspot.com//9589001
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4932 260f80e4-7a28-3924-810f-c04153c831b5
Each directory object creates a new service port which will start a
new thread. As these service ports are currently never closed this is
a huge problem causing the standalone VM to fail when running out of
threads.
This change uses a pool of native ports for directory operations. This
still ensures that the operations for each directory object are
serialized and limits the number of native ports allocated and thus
threads started.
Even when closing of native ports is possible we might want to keep
some kind of pool like this. The reason for this is that to actually
determine when the native port is not needed any more we need a
finalizer callback on the directory object.
R=ager@google.com
BUG=none
TEST=tests/standalone/src/ManyDirectoryOperationsTest.dart
Review URL: https://chromiumcodereview.appspot.com//9568010
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4795 260f80e4-7a28-3924-810f-c04153c831b5
Change the handling of the received data on HTTPRequest and
HTTPClientResponse to use the InputStream interface instead of
dataReceived and dataEnd handlers.
We should probably do something to make the following serer side and
client side patterns simpler:
void handler(HTTPRequest request, HTTPResponse response) {
...
StringBuffer body = new StringBuffer();
StringInputStream input = new StringInputStream(request.inputStream);
input.dataHandler = () => body.add(input.read());
input.closeHandler = () {
String data = body.toString();
...
}
}
HTTPClientConnection conn = ...
conn.responseHandler = (HTTPClientResponse r) {
...
StringBuffer body = new StringBuffer();
StringInputStream input = new StringInputStream(request.inputStream);
input.dataHandler = () => body.add(input.read());
input.closeHandler = () {
String data = body.toString();
...
}
}
R=ager@google.com,ajohnsen@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9495007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4679 260f80e4-7a28-3924-810f-c04153c831b5
big global change, so let me explain in more detail. This refactoring CL does
the following:
- moves all the dart code for isolates in a common library (lib/isolate)
- changes frog to understand 'dart:isolate' imoprts by loading the code from the
location above.
- changes the vm to undernstand 'dart:isolate' imports by creating a separate
library that is part of the bootstrap. This follows the same code-structure
that Todd suggested in his CL introducing the mirror library
- changes dartc to use the shared isolate library as the source of truth for
type checking. I left around some of the internal js code in dartc so that the
backend continues to work for apps that don't use isolates.
- changes all tests that use isolates to import the library explicitly (this is a large bulk of the files in this CL)
- changes test status for tests we can't fix in this repo (e.g. co19)
- splits the isolate library code to make it possible to preserve some tests
without exposing internal types (e.g. tests about
serialization/deserialization)
- changes the create_sdk script to copy the isolate library to the sdk
- includes the isolate library in dartdoc
I'll wait for at least one lgtm from each area (dartc, vm, frog, sdk)
There is one important pending thing this CL doesn't do:
- update test_runner.dart: This should be updated next time we upload the new
binaries to tool/testing/bin
- dartium specific changes: Vijay, is there anything I need to do for dartium?
Review URL: https://chromiumcodereview.appspot.com//9422019
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4647 260f80e4-7a28-3924-810f-c04153c831b5
The File class used to have two synchronous methods
openInputStream and openOutputStream for getting streams for a
file. These have now been changed to work asynchronously by the
associated callback inputStreamHandler or outputStreamHandler
when the stream is opened and available.
To support the synchronous API two new methods
openInputStreamSync and openOutputStreamSync which returns the
stream directly as before have been added.
The actual implemnetation of the file streams still uses the
synchronous file API internally. However this change
adds "simulated" handling of noPendingWriteHandler and
closeHandler for file output stream.
R=ager@google.com
BUG=dart:1784
TEST=
Review URL: https://chromiumcodereview.appspot.com//9432023
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4452 260f80e4-7a28-3924-810f-c04153c831b5
instead of an integer array initializer.
For example, the initializer in builtin_gen.cc now looks something like this:
const char Builtin::builtin_source_[] =
// ----- bin/builtin.dart -----
"// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file\n"
"// for details. All rights reserved. Use of this source code is governed by a\n"
"// BSD-style license that can be found in the LICENSE file.\n"
"\n"
"#library(\"builtin\");\n"
"#import(\"dart:nativewrappers\");\n"
"#import(\"dart:coreimpl\");\n"
"\n"
"void print(arg) {\n"
" _Logger._printString(arg.toString());\n" /* L10 */
"}\n"
"\n"
"void exit(int status) {\n"
" if (status is !int) {\n"
" throw new IllegalArgumentException(\"int status expected\");\n"
" }\n"
" _exit(status);\n"
"}\n"
"\n"
"_exit(int status) native \"Exit\";\n" /* L20 */
"\n"
"class _Logger {\n"
" static void _printString(String s) native \"Logger_PrintString\";\n"
"}\n"
;
Review URL: https://chromiumcodereview.appspot.com//9348112
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4280 260f80e4-7a28-3924-810f-c04153c831b5
The recent change to epoll on Linux and kqueue on Mac OS for getting
notifications from file descriptors caused the redirection of stdin,
stdout and stderr for the stand alone VM to stop working.
On Linux epoll failed when file descriptor 0, 1 or 2 redirected from
or to a file war registered. On Mac OS there was just no events
generated from kqueue.
The streams created for stdio, stdout and stderr is now of the correct
type and for file redirections no longer a socket object holding a
file descriptor for a regular file.
Added testing of stdio redirection using both pipes and files. These
tests are currently skipped on Windows.
Fixed handlin of short socket read when reading the process exit code.
Always close the socket port when not waiting for any events.
R=iposva@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9360040
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4226 260f80e4-7a28-3924-810f-c04153c831b5