Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
surround a bunch of stuff with domains.enable branches
  • Loading branch information
ry committed Sep 19, 2011
1 parent b8023a7 commit 7d5b38e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions lib/domains.js
Expand Up @@ -26,6 +26,8 @@ var util = require('util');
var domainIds = 0;
var allowBadHandleAccess = false;

exports.enabled = false;


var debug;
if (process.env.NODE_DEBUG && /domain/.test(process.env.NODE_DEBUG)) {
Expand Down Expand Up @@ -184,6 +186,8 @@ exports.remove = function(handle) {


exports.create = function(arg, cb) {
exports.enabled = true;
console.error("DOMAINS ENABLED");
var d = new Domain();
d.cb = cb;
d.arg = arg;
Expand Down
8 changes: 4 additions & 4 deletions lib/net_uv.js
Expand Up @@ -9,15 +9,15 @@ var domains = require('domains');
function createPipe() {
var Pipe = process.binding('pipe_wrap').Pipe;
var pipe = new Pipe();
domains.add(pipe);
if (domains.enabled) domains.add(pipe);
return pipe;
}

// constructor for lazy loading
function createTCP() {
var TCP = process.binding('tcp_wrap').TCP;
var tcp = new TCP();
domains.add(tcp);
if (domains.enabled) domains.add(tcp);
return tcp;
}

Expand All @@ -44,12 +44,12 @@ function isPipeName(s) {

function close(handle) {
handle.close();
domains.remove(handle);
if (domains.enabled) domains.remove(handle);
}


function closeReq(req) {
domains.remove(req);
if (domains.enabled) domains.remove(req);
}


Expand Down
2 changes: 1 addition & 1 deletion lib/timers_uv.js
Expand Up @@ -34,7 +34,7 @@ if (process.env.NODE_DEBUG && /timer/.test(process.env.NODE_DEBUG)) {

function closeTimer(t) {
t.close();
domains.remove(t);
if (domains.enabled) domains.remove(t);
}


Expand Down

0 comments on commit 7d5b38e

Please sign in to comment.