From 7faeada0f0662722e4a6636d279e38c2bf0bf375 Mon Sep 17 00:00:00 2001 From: Luke Petre Date: Tue, 6 Oct 2015 15:26:09 +0100 Subject: [PATCH] Handle callbacks within a domain --- src/lib/transport.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/transport.js b/src/lib/transport.js index 6e18112ec..c9a2a42d6 100644 --- a/src/lib/transport.js +++ b/src/lib/transport.js @@ -140,6 +140,10 @@ Transport.prototype.request = function (params, cb) { // determine the response based on the presense of a callback if (typeof cb === 'function') { + // handle callbacks within a domain + if (process.domain) { + cb = process.domain.bind(cb); + } ret = { abort: abortRequest };