From dee1cb27faa832e430404c9b48ef8db44d54e22f Mon Sep 17 00:00:00 2001 From: Moe Date: Thu, 23 Jun 2022 15:57:39 -0700 Subject: [PATCH] p2p reconnection only use readyState check and heartbeat check --- libs/commander/workerv2.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/commander/workerv2.js b/libs/commander/workerv2.js index 639775fb..c1887655 100644 --- a/libs/commander/workerv2.js +++ b/libs/commander/workerv2.js @@ -54,12 +54,12 @@ function clearAllTimeouts(){ clearTimeout(onClosedTimeout) } function startConnection(p2pServerAddress,subscriptionId){ - console.log('P2P : Connecting to Konekta P2P Server...') let tunnelToP2P stayDisconnected = false const allMessageHandlers = [] async function startWebsocketConnection(key,callback){ s.debugLog(`startWebsocketConnection EXECUTE`,new Error()) + console.log('P2P : Connecting to Konekta P2P Server...') function createWebsocketConnection(){ clearAllTimeouts() return new Promise((resolve,reject) => { @@ -82,9 +82,9 @@ function startConnection(p2pServerAddress,subscriptionId){ tunnelToP2P.on('close', () => { console.log(`P2P Connection Closed!`) clearAllTimeouts() - onClosedTimeout = setTimeout(() => { - disconnectedConnection(); - },5000) + // onClosedTimeout = setTimeout(() => { + // disconnectedConnection(); + // },5000) }); tunnelToP2P.onmessage = function(event){ const data = bson.deserialize(Buffer.from(event.data))