Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -478,7 +478,8 @@ export class WS2PCluster { ...@@ -478,7 +478,8 @@ export class WS2PCluster {
const pub = client.connection.pubkey const pub = client.connection.pubkey
const isNotOurself = pub !== this.server.conf.pair.pub const isNotOurself = pub !== this.server.conf.pair.pub
const isMember = await this.server.dal.isMember(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() client.connection.close()
await client.connection.closed await client.connection.closed
disconnectedOne = true disconnectedOne = true
...@@ -498,7 +499,8 @@ export class WS2PCluster { ...@@ -498,7 +499,8 @@ export class WS2PCluster {
const client = this.ws2pClients[uuid] const client = this.ws2pClients[uuid]
const pub = client.connection.pubkey const pub = client.connection.pubkey
const isNotOurself = pub !== this.server.conf.pair.pub 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() client.connection.close()
disconnectedOne = true disconnectedOne = true
await client.connection.closed await client.connection.closed
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment