Commit 268aba57 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[fix] #1166 PreferedNodes should have higher priority on trimming

parent 9aba06ac
......@@ -478,7 +478,8 @@ export class WS2PCluster {
const pub = client.connection.pubkey
const isNotOurself = pub !== this.server.conf.pair.pub
const isMember = await this.server.dal.isMember(pub)
if (isNotOurself && !isMember && !disconnectedOne) {
const isPrefered = this.getPreferedNodes().indexOf(pub) !== -1
if (isNotOurself && !isMember && !disconnectedOne && !isPrefered) {
client.connection.close()
await client.connection.closed
disconnectedOne = true
......@@ -498,7 +499,8 @@ export class WS2PCluster {
const client = this.ws2pClients[uuid]
const pub = client.connection.pubkey
const isNotOurself = pub !== this.server.conf.pair.pub
if (isNotOurself && !disconnectedOne && this.getPreferedNodes().indexOf(pub) === -1) {
const isPrefered = this.getPreferedNodes().indexOf(pub) !== -1
if (isNotOurself && !disconnectedOne && !isPrefered) {
client.connection.close()
disconnectedOne = true
await client.connection.closed
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment