From 5eb2f7d422d06a7f5c2ca9d17f0ace9ab4390948 Mon Sep 17 00:00:00 2001 From: librelois <elois@ifee.fr> Date: Wed, 29 Nov 2017 22:48:06 +0100 Subject: [PATCH] [enh] #1219 --- app/modules/ws2p/lib/WS2PCluster.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/modules/ws2p/lib/WS2PCluster.ts b/app/modules/ws2p/lib/WS2PCluster.ts index e00e4173d..6588f032b 100644 --- a/app/modules/ws2p/lib/WS2PCluster.ts +++ b/app/modules/ws2p/lib/WS2PCluster.ts @@ -348,6 +348,11 @@ export class WS2PCluster { } async connectToWS2Peers() { + // If incoming connections quota is full, delete one low-priority connection + if (this.ws2pServer !== null && this.ws2pServer.countConnexions() === this.ws2pServer.maxLevel2Peers) { + const privilegedKeys = ((this.server.conf.ws2p && this.server.conf.ws2p.privilegedNodes) || []).slice() // Copy + this.ws2pServer.removeLowPriorityConnection(privilegedKeys) + } const myUUID = (this.server.conf.ws2p && this.server.conf.ws2p.uuid) ? this.server.conf.ws2p.uuid:"" const potentials = await this.server.dal.getWS2Peers() const peers:PeerDTO[] = potentials.map((p:any) => PeerDTO.fromJSONObject(p)) -- GitLab