From 55079e603186661a32d8e219111cae2617b21c38 Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Thu, 2 Nov 2017 20:05:02 +0100
Subject: [PATCH] [fix] the ws2p connection to oneself fails in a loop ->
 disable oneself ws2p conection

---
 app/modules/ws2p/lib/WS2PCluster.ts | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/modules/ws2p/lib/WS2PCluster.ts b/app/modules/ws2p/lib/WS2PCluster.ts
index 7f015e75e..18076803f 100644
--- a/app/modules/ws2p/lib/WS2PCluster.ts
+++ b/app/modules/ws2p/lib/WS2PCluster.ts
@@ -347,7 +347,10 @@ export class WS2PCluster {
       const api = p.getWS2P()
       if (api) {
         try {
-          await this.connectToRemoteWS(api.host, api.port, api.path, this.messageHandler, p.pubkey, api.uuid)
+          // We do not connect to local host
+          if (!this.server.conf.ws2p || api.uuid !== this.server.conf.ws2p.uuid) {
+            await this.connectToRemoteWS(api.host, api.port, api.path, this.messageHandler, p.pubkey, api.uuid)
+          }
         } catch (e) {
           this.server.logger.debug('WS2P: init: failed connection')
         }
-- 
GitLab