summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/_http_outgoing.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js
index 8455b91603..66ed47a9bf 100644
--- a/lib/_http_outgoing.js
+++ b/lib/_http_outgoing.js
@@ -21,6 +21,7 @@
var assert = require('assert').ok;
var Stream = require('stream');
+var timers = require('timers');
var util = require('util');
var common = require('_http_common');
@@ -44,12 +45,14 @@ function utcDate() {
if (!dateCache) {
var d = new Date();
dateCache = d.toUTCString();
- setTimeout(function() {
- dateCache = undefined;
- }, 1000 - d.getMilliseconds());
+ timers.enroll(utcDate, 1000 - d.getMilliseconds());
+ timers._unrefActive(utcDate);
}
return dateCache;
}
+utcDate._onTimeout = function() {
+ dateCache = undefined;
+};
function OutgoingMessage() {