Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const establish_connection = () => {
const nbConnections = Object.keys(this._channels).length;
debugLog(" nbConnections ", nbConnections, " self._server.maxConnections",
this._server!.maxConnections, this.maxConnections);
if (nbConnections >= this.maxConnections) {
debugLog(chalk.bgWhite.cyan("OPCUAServerEndPoint#_on_client_connection " +
"The maximum number of connection has been reached - Connection is refused"));
socket.end();
(socket as any).destroy();
return;
}
debugLog("OPCUAServerEndPoint._on_client_connection successful => New Channel");
const channel = new ServerSecureChannelLayer({
defaultSecureTokenLifetime: this.defaultSecureTokenLifetime,
// objectFactory: this.objectFactory,
parent: this,
timeout: this.timeout
});
socket.resume();
this._preregisterChannel(channel);
channel.init(socket, (err?: Error) => {
this._un_pre_registerChannel(channel);
debugLog(chalk.yellow.bold("Channel#init done"), err);
if (err) {
socket.end();
} else {
const establish_connection = () => {
const nbConnections = Object.keys(this._channels).length;
debugLog(" nbConnections ", nbConnections, " self._server.maxConnections",
this._server!.maxConnections, this.maxConnections);
if (nbConnections >= this.maxConnections) {
debugLog(chalk.bgWhite.cyan("OPCUAServerEndPoint#_on_client_connection " +
"The maximum number of connection has been reached - Connection is refused"));
socket.end();
(socket as any).destroy();
return;
}
debugLog("OPCUAServerEndPoint._on_client_connection successful => New Channel");
const channel = new ServerSecureChannelLayer({
defaultSecureTokenLifetime: this.defaultSecureTokenLifetime,
// objectFactory: this.objectFactory,
parent: this,
timeout: this.timeout
});
socket.resume();
this._preregisterChannel(channel);
channel.init(socket, (err?: Error) => {
this._un_pre_registerChannel(channel);
debugLog(chalk.yellow.bold("Channel#init done"), err);
if (err) {
socket.end();
} else {