Page MenuHomePhorge

D14771.1768460633.diff
No OneTemporary

Size
4 KB
Referenced Files
None
Subscribers
None

D14771.1768460633.diff

diff --git a/lib/tunnelbroker/peer-to-peer-message-handler.js b/lib/tunnelbroker/peer-to-peer-message-handler.js
--- a/lib/tunnelbroker/peer-to-peer-message-handler.js
+++ b/lib/tunnelbroker/peer-to-peer-message-handler.js
@@ -7,6 +7,7 @@
useHandleOlmMessageToDevice,
usePeerToPeerMessageHandler,
} from './use-peer-to-peer-message-handler.js';
+import { useDebugLogs } from '../components/debug-logs-context.js';
import { useLoggedInUserInfo } from '../hooks/account-hooks.js';
import { useActionsQueue } from '../hooks/actions-queue.js';
import { usePersistedStateLoaded } from '../selectors/app-state-selectors.js';
@@ -37,6 +38,8 @@
const handleOlmMessageToDevice = useHandleOlmMessageToDevice();
const persistedStateLoaded = usePersistedStateLoaded();
+ const { addLog } = useDebugLogs();
+
const processItem = React.useCallback(
async (
item:
@@ -88,10 +91,12 @@
messageIDs: [messageID],
};
socketSend(JSON.stringify(confirmation));
+ addLog('Tunnelbroker', `Confirmed a message with ID: ${messageID}`);
}
}
},
[
+ addLog,
doesSocketExist,
getSessionCounter,
handleOlmMessageToDevice,
@@ -125,6 +130,10 @@
// Client received incorrect message, confirm to remove from
// Tunnelbroker queue.
socketSend(JSON.stringify(confirmation));
+ addLog(
+ 'Tunnelbroker',
+ `Confirmed an incorrect message with ID: ${message.messageID}`,
+ );
return;
}
@@ -133,6 +142,10 @@
// The client received an invalid Tunnelbroker message,
// and cannot process this type of request.
socketSend(JSON.stringify(confirmation));
+ addLog(
+ 'Tunnelbroker',
+ `Confirmed an invalid message with ID: ${message.messageID}`,
+ );
return;
}
const peerToPeerMessage: PeerToPeerMessage = rawPeerToPeerMessage;
@@ -147,7 +160,7 @@
},
]);
},
- [enqueue, getSessionCounter, socketSend],
+ [addLog, enqueue, getSessionCounter, socketSend],
);
React.useEffect(() => {
diff --git a/lib/tunnelbroker/tunnelbroker-context.js b/lib/tunnelbroker/tunnelbroker-context.js
--- a/lib/tunnelbroker/tunnelbroker-context.js
+++ b/lib/tunnelbroker/tunnelbroker-context.js
@@ -9,6 +9,7 @@
import { PeerToPeerMessageHandler } from './peer-to-peer-message-handler.js';
import type { SecondaryTunnelbrokerConnection } from './secondary-tunnelbroker-connection.js';
import { useInvalidCSATLogOut } from '../actions/user-actions.js';
+import { useDebugLogs } from '../components/debug-logs-context.js';
import { PeerOlmSessionCreatorProvider } from '../components/peer-olm-session-creator-provider.react.js';
import { tunnnelbrokerURL } from '../facts/tunnelbroker.js';
import { DMOpsQueueHandler } from '../shared/dm-ops/dm-ops-queue-handler.react.js';
@@ -197,6 +198,8 @@
socket.current?.readyState === WebSocket.OPEN ||
socket.current?.readyState === WebSocket.CONNECTING;
+ const { addLog } = useDebugLogs();
+
const connectionChangePromise = React.useRef<?Promise<void>>(null);
// The Tunnelbroker connection can have 4 states:
// - DISCONNECTED: isSocketActive = false, connected = false
@@ -358,6 +361,10 @@
socket.current = tunnelbrokerSocket;
socketSessionCounter.current = socketSessionCounter.current + 1;
+ addLog(
+ 'Tunnelbroker',
+ `A new session created with counter=${socketSessionCounter.current}`,
+ );
} catch (err) {
console.log('Tunnelbroker connection error:', err);
}
@@ -374,6 +381,7 @@
socketState.retryCount,
invalidTokenLogOut,
resetSocketState,
+ addLog,
]);
const sendMessage: (request: DeviceToTunnelbrokerRequest) => Promise<void> =
@@ -513,9 +521,10 @@
type: deviceToTunnelbrokerMessageTypes.MESSAGE_RECEIVE_CONFIRMATION,
messageIDs: [messageID],
};
+ addLog('Tunnelbroker', `Confirmed a message with ID: ${messageID}`);
socket.current?.send(JSON.stringify(confirmation));
},
- [],
+ [addLog],
);
const value: TunnelbrokerContextType = React.useMemo(

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 15, 7:03 AM (15 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5932686
Default Alt Text
D14771.1768460633.diff (4 KB)

Event Timeline