Skip to content
Snippets Groups Projects
Commit 7591dfc8 authored by Éloïs's avatar Éloïs
Browse files

Allow ws2p connections to endpoints with the same uuid but different pubkey

parent 60da2608
No related branches found
No related tags found
No related merge requests found
......@@ -348,7 +348,7 @@ export class WS2PCluster {
if (api) {
try {
// We do not connect to local host
if (!this.server.conf.ws2p || api.uuid !== this.server.conf.ws2p.uuid) {
if (!this.server.conf.ws2p || api.uuid !== this.server.conf.ws2p.uuid || p.pubkey !== this.server.conf.pair.pub) {
await this.connectToRemoteWS(api.host, api.port, api.path, this.messageHandler, p.pubkey, api.uuid)
}
} catch (e) {
......@@ -376,7 +376,7 @@ export class WS2PCluster {
// Check if already connected to the pubkey (in any way: server or client)
const connectedPubkeys = this.getConnectedPubkeys()
const shouldAccept = await this.acceptPubkey(peer.pubkey, connectedPubkeys, () => this.clientsCount(), this.maxLevel1Size, (this.server.conf.ws2p && this.server.conf.ws2p.preferedNodes || []), ws2pEnpoint.uuid)
if (shouldAccept) {
if (shouldAccept && (!this.server.conf.ws2p || ws2pEnpoint.uuid !== this.server.conf.ws2p.uuid || peer.pubkey !== this.server.conf.pair.pub)) {
await this.connectToRemoteWS(ws2pEnpoint.host, ws2pEnpoint.port, ws2pEnpoint.path, this.messageHandler, peer.pubkey)
await this.trimClientConnections()
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment