This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Set watcher.next = null after removed from dumpQueue

  • Loading branch information...
ry committed Nov 11, 2010
1 parent f120638 commit 5705453735ac9b51c0e0f1908a21c5c0b80cd899
Showing with 8 additions and 5 deletions.
  1. +2 −1 src/node_io_watcher.cc
  2. +3 −2 test/simple/test-dumper-unix.js
  3. +3 −2 test/simple/test-dumper.js
View
@@ -254,7 +254,8 @@ void IOWatcher::Dump(EV_P_ ev_prepare *w, int revents) {
for (watcher_v = dump_queue->Get(next_sym);
watcher_v->IsObject();
- dump_queue->Set(next_sym, (watcher_v = watcher->Get(next_sym)))) {
+ dump_queue->Set(next_sym, (watcher_v = watcher->Get(next_sym))),
+ watcher->Set(next_sym, Null())) {
watcher = watcher_v->ToObject();
IOWatcher *io = ObjectWrap::Unwrap<IOWatcher>(watcher);
@@ -1,6 +1,7 @@
var assert =require('assert');
var IOWatcher = process.binding('io_watcher').IOWatcher;
var errnoException = process.binding('net').errnoException;
+var close = process.binding('net').close;
var net = require('net');
var ncomplete = 0;
@@ -58,9 +59,8 @@ function test (N, b, cb) {
assert.ok(nread === expected);
assert.equal(1, ndrain);
assert.equal(0, nerror);
- w.stop();
console.error("done. wrote %d bytes\n", nread);
- process.binding('net').close(fds[1]);
+ close(fds[1]);
}
});
@@ -71,6 +71,7 @@ function test (N, b, cb) {
for (var x = IOWatcher.dumpQueue; x; x = x.next) {
assert.ok(x !== w);
}
+ assert.equal(null, w.next);
ncomplete++;
if (cb) cb();
@@ -1,6 +1,7 @@
var assert =require('assert');
var IOWatcher = process.binding('io_watcher').IOWatcher;
var errnoException = process.binding('net').errnoException;
+var close = process.binding('net').close;
var net = require('net');
var ncomplete = 0;
@@ -57,9 +58,8 @@ function test (N, b, cb) {
assert.ok(nread === expected);
assert.equal(1, ndrain);
assert.equal(0, nerror);
- w.stop();
console.error("done. wrote %d bytes\n", nread);
- process.binding('net').close(fds[1]);
+ close(fds[1]);
}
});
@@ -68,6 +68,7 @@ function test (N, b, cb) {
for (var x = IOWatcher.dumpQueue; x; x = x.next) {
assert.ok(x !== w);
}
+ assert.equal(null, w.next);
ncomplete++;
if (cb) cb();

0 comments on commit 5705453

Please sign in to comment.