Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

Commit

Permalink
Merge pull request #448 from cfchou/dev_160401
Browse files Browse the repository at this point in the history
configurable maxConnections per interface
  • Loading branch information
mcollina committed Apr 14, 2016
2 parents 48a6580 + df9c91f commit 1ff1eb9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ function modernize(legacy) {
mqtt_interface.port = legacy.port;
}

if (legacy.hasOwnProperty('maxConnections')) {
mqtt_interface.maxConnections = legacy.maxConnections;
}

modernized.interfaces.push(mqtt_interface);
}

Expand Down Expand Up @@ -320,6 +324,7 @@ function defaultsLegacy() {
return {
port: 1883,
host: null,
maxConnections: 10000000,
backend: {
json: false,
wildcardOne: '+',
Expand Down Expand Up @@ -353,7 +358,7 @@ function defaultsModern() {
return {
host: null,
interfaces: [
{ type: "mqtt", port: 1883 }
{ type: "mqtt", port: 1883, maxConnections: 10000000 }
],
backend: {
json: false,
Expand Down
2 changes: 1 addition & 1 deletion lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function Server(opts, callback) {

var server = interfaces.serverFactory(iface, fallback, that);
that.servers.push(server);
server.maxConnections = 10000000;
server.maxConnections = iface.maxConnections || 10000000;
server.listen(port, host, dn);
}, done);
},
Expand Down
2 changes: 1 addition & 1 deletion test/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe("mocha.options", function () {
expect(modern).to.have.property("interfaces");
expect(modern.interfaces).to.be.deep.equal(
[
{ type: "mqtt", port: 1883 }
{ type: "mqtt", port: 1883, maxConnections: 10000000 }
]
);
});
Expand Down

0 comments on commit 1ff1eb9

Please sign in to comment.