diff --git a/lib/modem.js b/lib/modem.js index 6e60587..b1292ce 100644 --- a/lib/modem.js +++ b/lib/modem.js @@ -283,17 +283,15 @@ Modem.prototype.buildRequest = function (options, context, data, callback) { if (self.connectionTimeout) { connectionTimeoutTimer = setTimeout(function () { debug('Connection Timeout of %s ms exceeded', self.connectionTimeout); - req.abort(); + req.destroy(); }, self.connectionTimeout); } if (self.timeout) { - req.on('socket', function (socket) { - socket.setTimeout(self.timeout); - socket.on('timeout', function () { - debug('Timeout of %s ms exceeded', self.timeout); - req.abort(); - }); + req.setTimeout(self.timeout); + req.on('timeout', function () { + debug('Timeout of %s ms exceeded', self.timeout); + req.destroy(); }); } diff --git a/package-lock.json b/package-lock.json index 9c39b9a..d2535aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "docker-modem", - "version": "5.0.3", + "version": "5.0.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "docker-modem", - "version": "5.0.3", + "version": "5.0.4", "license": "Apache-2.0", "dependencies": { "debug": "^4.1.1", diff --git a/package.json b/package.json index 31f5540..dfe9e9e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "docker-modem", "description": "Docker remote API network layer module.", - "version": "5.0.3", + "version": "5.0.4", "author": "Pedro Dias ", "maintainers": [ "apocas "