diff --git a/ChangeLog b/ChangeLog
index 9eef860976..d36033a8cb 100644
--- a/ChangeLog
+++ b/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)
- New Buffer object for binary data.
diff --git a/benchmark/http_simple.js b/benchmark/http_simple.js
index e1eb6b5779..e709f2d724 100644
--- a/benchmark/http_simple.js
+++ b/benchmark/http_simple.js
@@ -4,6 +4,8 @@ var puts = require("sys").puts;
var old = (process.argv[2] == 'old');
+puts('pid ' + process.pid);
+
http = require(old ? "http_old" : 'http');
if (old) puts('old version');
diff --git a/doc/api_header.html b/doc/api_header.html
index 498bc9ebd3..7340bdbbde 100644
--- a/doc/api_header.html
+++ b/doc/api_header.html
@@ -130,7 +130,7 @@
diff --git a/doc/index.html b/doc/index.html
index e9c96c9493..338798cbf8 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -95,8 +95,8 @@ server.listen(7000, "localhost");
git repo
- 2010.04.09
- node-v0.1.90.tar.gz
+ 2010.04.15
+ node-v0.1.91.tar.gz
Build
diff --git a/lib/net.js b/lib/net.js
index 16044e4835..125582f8a2 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -543,13 +543,10 @@ Stream.prototype._writeOut = function (data, encoding) {
allocNewPool();
}
- if (encoding == 'utf8' || encoding == 'utf-8') {
+ if (!encoding || encoding == 'utf8' || encoding == 'utf-8') {
// default to utf8
bytesWritten = pool.write(data, 'utf8', pool.used);
- // XXX Hacky way to find out the number of characters written.
- // Waiting for a more optimal way: http://codereview.chromium.org/1539013
- var _s = pool.toString('utf8', pool.used, pool.used + bytesWritten);
- charsWritten = _s.length;
+ charsWritten = Buffer._charsWritten;
} else {
bytesWritten = pool.write(data, encoding, pool.used);
charsWritten = bytesWritten;
diff --git a/src/node.cc b/src/node.cc
index 29115c71e5..f312b2d9a7 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -105,8 +105,21 @@ static ev_tstamp last_active;
static ev_timer gc_timer;
static ev_check gc_check;
static ev_idle gc_idle;
-static bool needs_gc;
-#define GC_INTERVAL 2.0
+#define GC_INTERVAL 1.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) {
@@ -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;
if (idle_time > GC_INTERVAL) {
- if (needs_gc) {
- needs_gc = false;
- if (!V8::IdleNotification()) {
- ev_idle_start(EV_DEFAULT_UC_ &gc_idle);
- }
+ if (!V8::IdleNotification()) {
+ ev_idle_start(EV_DEFAULT_UC_ &gc_idle);
}
- // reset the timer
- gc_timer.repeat = GC_INTERVAL;
- ev_timer_again(EV_DEFAULT_UC_ watcher);
+ gc_timer_stop();
}
}
@@ -139,8 +147,8 @@ static void NotifyIdleness(EV_P_ ev_idle *watcher, int revents) {
if (V8::IdleNotification()) {
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.
- pending -= ev_is_pending(&gc_timer);
- pending -= ev_is_pending(&gc_idle);
- pending -= ev_is_pending(&next_tick_watcher);
- //if (ev_is_pending(&gc_check)) pending--; // This probably never happens?
+ if (ev_is_pending(&gc_timer)) pending--;
+ if (ev_is_pending(&gc_idle)) pending--;
+ if (ev_is_pending(&gc_check)) pending--;
+
+ assert(pending >= 0);
//fprintf(stderr, "activity, pending: %d\n", pending);
if (pending) {
last_active = ev_now(EV_DEFAULT_UC);
ev_idle_stop(EV_DEFAULT_UC_ &gc_idle);
-
- if (!needs_gc) {
- gc_timer.repeat = GC_INTERVAL;
- ev_timer_again(EV_DEFAULT_UC_ &gc_timer);
- }
-
- needs_gc = true;
+ gc_timer_start();
}
}
@@ -1607,10 +1610,7 @@ int main(int argc, char *argv[]) {
ev_idle_init(&node::tick_spinner, node::Spin);
- ev_init(&node::gc_timer, node::CheckIdleness);
- node::gc_timer.repeat = GC_INTERVAL;
- ev_timer_again(EV_DEFAULT_UC_ &node::gc_timer);
- ev_unref(EV_DEFAULT_UC);
+ ev_timer_init(&node::gc_timer, node::CheckIdleness, 2*GC_INTERVAL, 2*GC_INTERVAL);
ev_check_init(&node::gc_check, node::Activity);
ev_check_start(EV_DEFAULT_UC_ &node::gc_check);
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
index 45586c38c3..62c667b40c 100644
--- a/src/node_buffer.cc
+++ b/src/node_buffer.cc
@@ -38,6 +38,7 @@ using namespace v8;
static Persistent
length_symbol;
+static Persistent chars_written_sym;
Persistent Buffer::constructor_template;
@@ -308,11 +309,16 @@ Handle Buffer::Utf8Write(const Arguments &args) {
const char *p = buffer->data() + offset;
+ int char_written;
+
int written = s->WriteUtf8((char*)p,
buffer->length_ - offset,
- NULL,
+ &char_written,
String::HINT_MANY_WRITES_EXPECTED);
+ constructor_template->GetFunction()->Set(chars_written_sym,
+ Integer::New(char_written));
+
if (written > 0 && p[written-1] == '\0') written--;
return scope.Close(Integer::New(written));
@@ -463,6 +469,7 @@ void Buffer::Initialize(Handle