Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http, timers: remove domain specific code #18477

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions lib/_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,6 @@ function parserOnIncomingClient(res, shouldKeepAlive) {
var socket = this.socket;
var req = socket._httpMessage;

// propagate "domain" setting...
if (req.domain && !res.domain) {
debug('setting "res.domain"');
res.domain = req.domain;
}

debug('AGENT incoming response!');

if (req.res) {
Expand Down
1 change: 0 additions & 1 deletion lib/timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,6 @@ Timeout.prototype.unref = function() {
this._handle.owner = this;
this._handle[kOnTimeout] = unrefdHandle;
this._handle.start(delay);
this._handle.domain = this.domain;
this._handle.unref();
}
return this;
Expand Down
8 changes: 7 additions & 1 deletion test/parallel/test-domain-timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,19 @@ timeoutd.on('error', common.mustCall(function(e) {
assert.strictEqual(e.message, 'Timeout UNREFd',
'Domain should catch timer error');
clearTimeout(timeout);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we clear the timeout only on second call?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't matter. They will all fire during the same loop run. That timeout is just there to make sure it doesn't exit before it gets a chance to enter the event loop.

}));
}, 2));

let t;
timeoutd.run(function() {
setTimeout(function() {
throw new Error('Timeout UNREFd');
}, 0).unref();

t = setTimeout(function() {
throw new Error('Timeout UNREFd');
}, 0);
});
t.unref();

const immediated = domain.create();

Expand Down