diff --git a/docs/Reference.md b/docs/Reference.md index fa273ea14..203b80b7b 100755 --- a/docs/Reference.md +++ b/docs/Reference.md @@ -225,7 +225,7 @@ When creating a server instance, the following options configure the server's be - `tls` - used to create an HTTPS server. The `tls` object is passed unchanged as options to the node.js HTTPS server as described in the [node.js HTTPS documentation](http://nodejs.org/api/https.html#https_https_createserver_options_requestlistener).

-- `maxSockets` - used to set the number of sockets available per outgoing host connection. Default is 5. This impacts all servers sharing the process. +- `maxSockets` - used to set the number of sockets available per outgoing host connection. Default is null. This impacts all servers sharing the process.

- `views` - enables support for view rendering (using templates to generate responses). Disabled by default. To enable, set to an object with the following options: diff --git a/lib/defaults.js b/lib/defaults.js index ef6a9d7ce..dd3f3a086 100755 --- a/lib/defaults.js +++ b/lib/defaults.js @@ -20,6 +20,8 @@ exports.server = { // cert: '' // }, + maxSockets: null, // Sets http/https globalAgent maxSockets value + // Router router: { @@ -80,8 +82,7 @@ exports.server = { cors: false, // CORS headers on responses and OPTIONS requests (defaults: exports.cors): false -> null, true -> defaults, {} -> override defaults views: null, // Views engine - auth: {}, // Authentication - maxSockets: 5 // Sets http/https globalAgent maxSockets value + auth: {} // Authentication }; diff --git a/lib/server.js b/lib/server.js index b9074e895..d5ff02d94 100755 --- a/lib/server.js +++ b/lib/server.js @@ -119,8 +119,10 @@ module.exports = internals.Server = function (/* host, port, options */) { this.listener = Http.createServer(this._dispatch()); } - Https.globalAgent.maxSockets = this.settings.maxSockets; - Http.globalAgent.maxSockets = this.settings.maxSockets; + if (this.settings.maxSockets !== null) { + Https.globalAgent.maxSockets = this.settings.maxSockets; + Http.globalAgent.maxSockets = this.settings.maxSockets; + } // Authentication