Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 1x 30x 38x 38x 24x 24x | /*eslint-env node */
/**
* Centro extension for limiting the number of concurrent connections each
* transport supports.
*
* @module centro-js/lib/server_extensions/limit_transport
*/
"use strict";
/**
* Limit the number of connections each transport supports. Doesn't apply to
* the {@link centro-js/lib/server_transports/in-mem|in-mem} transport.
*
* @param {Object} config - Configuration options.
* @param {integer} config.max_transport_connections - Maximum number of concurrent connections accepted by each transport.
*/
exports.limit_transport_connections = function (config)
{
return {
transport_ready: function (tconfig, ops)
{
var cfg = Object.assign({}, config, tconfig);
if (cfg.max_transport_connections && ops.server)
{
var server = ops.server.server ? ops.server.server : ops.server;
server.maxConnections = cfg.max_transport_connections;
}
}
};
};
|