Merge branch 'master' into openssl
This commit is contained in:
commit
e6a1091cc6
24
ChangeLog
24
ChangeLog
@ -1,4 +1,26 @@
|
|||||||
2010.04.09, Version 0.1.90
|
2010.04.15, Version 0.1.91
|
||||||
|
|
||||||
|
* Add incoming.httpVersion
|
||||||
|
|
||||||
|
* Object.prototype problem with C-Ares binding
|
||||||
|
|
||||||
|
* REPL can be run from multiple different streams. (Matt Ranney)
|
||||||
|
|
||||||
|
* After V8 heap is compact, don't use a timer every 2 seconds.
|
||||||
|
|
||||||
|
* Improve nextTick implementation.
|
||||||
|
|
||||||
|
* Add primative support for Upgrading HTTP connections.
|
||||||
|
(See commit log for docs 760bba5)
|
||||||
|
|
||||||
|
* Add timeout and maxBuffer options to child_process.exec
|
||||||
|
|
||||||
|
* Fix bugs.
|
||||||
|
|
||||||
|
* Upgrade V8 to 2.2.3.1
|
||||||
|
|
||||||
|
|
||||||
|
2010.04.09, Version 0.1.90, 07e64d45ffa1856e824c4fa6afd0442ba61d6fd8
|
||||||
|
|
||||||
* Merge writing of networking system (net2)
|
* Merge writing of networking system (net2)
|
||||||
- New Buffer object for binary data.
|
- New Buffer object for binary data.
|
||||||
|
@ -4,6 +4,8 @@ var puts = require("sys").puts;
|
|||||||
|
|
||||||
var old = (process.argv[2] == 'old');
|
var old = (process.argv[2] == 'old');
|
||||||
|
|
||||||
|
puts('pid ' + process.pid);
|
||||||
|
|
||||||
http = require(old ? "http_old" : 'http');
|
http = require(old ? "http_old" : 'http');
|
||||||
if (old) puts('old version');
|
if (old) puts('old version');
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="toc">
|
<div id="toc">
|
||||||
<div id="toctitle">Node v0.1.90</div>
|
<div id="toctitle">Node v0.1.91</div>
|
||||||
<noscript>JavaScript must be enabled in your browser to display the table of contents.</noscript>
|
<noscript>JavaScript must be enabled in your browser to display the table of contents.</noscript>
|
||||||
</div>
|
</div>
|
||||||
<div id='man'>
|
<div id='man'>
|
||||||
|
@ -95,8 +95,8 @@ server.listen(7000, "localhost");</pre>
|
|||||||
<a href="http://github.com/ry/node/tree/master">git repo</a>
|
<a href="http://github.com/ry/node/tree/master">git repo</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
2010.04.09
|
2010.04.15
|
||||||
<a href="http://nodejs.org/dist/node-v0.1.90.tar.gz">node-v0.1.90.tar.gz</a>
|
<a href="http://nodejs.org/dist/node-v0.1.91.tar.gz">node-v0.1.91.tar.gz</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2 id="build">Build</h2>
|
<h2 id="build">Build</h2>
|
||||||
|
@ -543,13 +543,10 @@ Stream.prototype._writeOut = function (data, encoding) {
|
|||||||
allocNewPool();
|
allocNewPool();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (encoding == 'utf8' || encoding == 'utf-8') {
|
if (!encoding || encoding == 'utf8' || encoding == 'utf-8') {
|
||||||
// default to utf8
|
// default to utf8
|
||||||
bytesWritten = pool.write(data, 'utf8', pool.used);
|
bytesWritten = pool.write(data, 'utf8', pool.used);
|
||||||
// XXX Hacky way to find out the number of characters written.
|
charsWritten = Buffer._charsWritten;
|
||||||
// Waiting for a more optimal way: http://codereview.chromium.org/1539013
|
|
||||||
var _s = pool.toString('utf8', pool.used, pool.used + bytesWritten);
|
|
||||||
charsWritten = _s.length;
|
|
||||||
} else {
|
} else {
|
||||||
bytesWritten = pool.write(data, encoding, pool.used);
|
bytesWritten = pool.write(data, encoding, pool.used);
|
||||||
charsWritten = bytesWritten;
|
charsWritten = bytesWritten;
|
||||||
|
48
src/node.cc
48
src/node.cc
@ -105,8 +105,21 @@ static ev_tstamp last_active;
|
|||||||
static ev_timer gc_timer;
|
static ev_timer gc_timer;
|
||||||
static ev_check gc_check;
|
static ev_check gc_check;
|
||||||
static ev_idle gc_idle;
|
static ev_idle gc_idle;
|
||||||
static bool needs_gc;
|
#define GC_INTERVAL 1.0
|
||||||
#define GC_INTERVAL 2.0
|
|
||||||
|
static void gc_timer_start () {
|
||||||
|
if (!ev_is_active(&gc_timer)) {
|
||||||
|
ev_timer_start(EV_DEFAULT_UC_ &gc_timer);
|
||||||
|
ev_unref(EV_DEFAULT_UC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gc_timer_stop () {
|
||||||
|
if (ev_is_active(&gc_timer)) {
|
||||||
|
ev_ref(EV_DEFAULT_UC);
|
||||||
|
ev_timer_stop(EV_DEFAULT_UC_ &gc_timer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void CheckIdleness(EV_P_ ev_timer *watcher, int revents) {
|
static void CheckIdleness(EV_P_ ev_timer *watcher, int revents) {
|
||||||
@ -118,15 +131,10 @@ static void CheckIdleness(EV_P_ ev_timer *watcher, int revents) {
|
|||||||
ev_tstamp idle_time = ev_now(EV_DEFAULT_UC) - last_active;
|
ev_tstamp idle_time = ev_now(EV_DEFAULT_UC) - last_active;
|
||||||
|
|
||||||
if (idle_time > GC_INTERVAL) {
|
if (idle_time > GC_INTERVAL) {
|
||||||
if (needs_gc) {
|
|
||||||
needs_gc = false;
|
|
||||||
if (!V8::IdleNotification()) {
|
if (!V8::IdleNotification()) {
|
||||||
ev_idle_start(EV_DEFAULT_UC_ &gc_idle);
|
ev_idle_start(EV_DEFAULT_UC_ &gc_idle);
|
||||||
}
|
}
|
||||||
}
|
gc_timer_stop();
|
||||||
// reset the timer
|
|
||||||
gc_timer.repeat = GC_INTERVAL;
|
|
||||||
ev_timer_again(EV_DEFAULT_UC_ watcher);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,8 +147,8 @@ static void NotifyIdleness(EV_P_ ev_idle *watcher, int revents) {
|
|||||||
|
|
||||||
if (V8::IdleNotification()) {
|
if (V8::IdleNotification()) {
|
||||||
ev_idle_stop(EV_A_ watcher);
|
ev_idle_stop(EV_A_ watcher);
|
||||||
|
gc_timer_stop();
|
||||||
}
|
}
|
||||||
needs_gc = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -152,23 +160,18 @@ static void Activity(EV_P_ ev_check *watcher, int revents) {
|
|||||||
|
|
||||||
// Don't count GC watchers as activity.
|
// Don't count GC watchers as activity.
|
||||||
|
|
||||||
pending -= ev_is_pending(&gc_timer);
|
if (ev_is_pending(&gc_timer)) pending--;
|
||||||
pending -= ev_is_pending(&gc_idle);
|
if (ev_is_pending(&gc_idle)) pending--;
|
||||||
pending -= ev_is_pending(&next_tick_watcher);
|
if (ev_is_pending(&gc_check)) pending--;
|
||||||
//if (ev_is_pending(&gc_check)) pending--; // This probably never happens?
|
|
||||||
|
assert(pending >= 0);
|
||||||
|
|
||||||
//fprintf(stderr, "activity, pending: %d\n", pending);
|
//fprintf(stderr, "activity, pending: %d\n", pending);
|
||||||
|
|
||||||
if (pending) {
|
if (pending) {
|
||||||
last_active = ev_now(EV_DEFAULT_UC);
|
last_active = ev_now(EV_DEFAULT_UC);
|
||||||
ev_idle_stop(EV_DEFAULT_UC_ &gc_idle);
|
ev_idle_stop(EV_DEFAULT_UC_ &gc_idle);
|
||||||
|
gc_timer_start();
|
||||||
if (!needs_gc) {
|
|
||||||
gc_timer.repeat = GC_INTERVAL;
|
|
||||||
ev_timer_again(EV_DEFAULT_UC_ &gc_timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
needs_gc = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1607,10 +1610,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
ev_idle_init(&node::tick_spinner, node::Spin);
|
ev_idle_init(&node::tick_spinner, node::Spin);
|
||||||
|
|
||||||
ev_init(&node::gc_timer, node::CheckIdleness);
|
ev_timer_init(&node::gc_timer, node::CheckIdleness, 2*GC_INTERVAL, 2*GC_INTERVAL);
|
||||||
node::gc_timer.repeat = GC_INTERVAL;
|
|
||||||
ev_timer_again(EV_DEFAULT_UC_ &node::gc_timer);
|
|
||||||
ev_unref(EV_DEFAULT_UC);
|
|
||||||
|
|
||||||
ev_check_init(&node::gc_check, node::Activity);
|
ev_check_init(&node::gc_check, node::Activity);
|
||||||
ev_check_start(EV_DEFAULT_UC_ &node::gc_check);
|
ev_check_start(EV_DEFAULT_UC_ &node::gc_check);
|
||||||
|
@ -38,6 +38,7 @@ using namespace v8;
|
|||||||
|
|
||||||
|
|
||||||
static Persistent<String> length_symbol;
|
static Persistent<String> length_symbol;
|
||||||
|
static Persistent<String> chars_written_sym;
|
||||||
Persistent<FunctionTemplate> Buffer::constructor_template;
|
Persistent<FunctionTemplate> Buffer::constructor_template;
|
||||||
|
|
||||||
|
|
||||||
@ -308,11 +309,16 @@ Handle<Value> Buffer::Utf8Write(const Arguments &args) {
|
|||||||
|
|
||||||
const char *p = buffer->data() + offset;
|
const char *p = buffer->data() + offset;
|
||||||
|
|
||||||
|
int char_written;
|
||||||
|
|
||||||
int written = s->WriteUtf8((char*)p,
|
int written = s->WriteUtf8((char*)p,
|
||||||
buffer->length_ - offset,
|
buffer->length_ - offset,
|
||||||
NULL,
|
&char_written,
|
||||||
String::HINT_MANY_WRITES_EXPECTED);
|
String::HINT_MANY_WRITES_EXPECTED);
|
||||||
|
|
||||||
|
constructor_template->GetFunction()->Set(chars_written_sym,
|
||||||
|
Integer::New(char_written));
|
||||||
|
|
||||||
if (written > 0 && p[written-1] == '\0') written--;
|
if (written > 0 && p[written-1] == '\0') written--;
|
||||||
|
|
||||||
return scope.Close(Integer::New(written));
|
return scope.Close(Integer::New(written));
|
||||||
@ -463,6 +469,7 @@ void Buffer::Initialize(Handle<Object> target) {
|
|||||||
HandleScope scope;
|
HandleScope scope;
|
||||||
|
|
||||||
length_symbol = Persistent<String>::New(String::NewSymbol("length"));
|
length_symbol = Persistent<String>::New(String::NewSymbol("length"));
|
||||||
|
chars_written_sym = Persistent<String>::New(String::NewSymbol("_charsWritten"));
|
||||||
|
|
||||||
Local<FunctionTemplate> t = FunctionTemplate::New(Buffer::New);
|
Local<FunctionTemplate> t = FunctionTemplate::New(Buffer::New);
|
||||||
constructor_template = Persistent<FunctionTemplate>::New(t);
|
constructor_template = Persistent<FunctionTemplate>::New(t);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user