function Request(type, name, root) { this.children = []; this.name = name; this.type = type; if (root === true) { var reqDomain = domain.create(); reqDomain.enter(); } if (process.domain) { this.parent = process.domain.currentRequest; } this.id = nextEventId; ++nextEventId; if (this.parent) { this.top = this.parent.top; this.parent.children.push(this); } else { this.top = this; if (this.type) { /* If we're the top and we're a type, we get a request Id, not an event Id */ this.id = nextRequestId; ++nextRequestId; } } }