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 @@ -32,7 +32,7 @@ function PeerToPeerMessageHandler(props: Props): React.Node { const { socketSend, getSessionCounter, doesSocketExist } = props; - const { addListener, removeListener } = useTunnelbroker(); + const { addListener, removeListener, socketState } = useTunnelbroker(); const peerToPeerMessageHandler = usePeerToPeerMessageHandler(); const handleOlmMessageToDevice = useHandleOlmMessageToDevice(); const persistedStateLoaded = usePersistedStateLoaded(); @@ -104,7 +104,10 @@ socketSend, ], ); - const { enqueue } = useActionsQueue(processItem, persistedStateLoaded); + const { enqueue } = useActionsQueue( + processItem, + persistedStateLoaded && !!socketState.isAuthorized, + ); const tunnelbrokerMessageListener = React.useCallback( async (message: TunnelbrokerToDeviceMessage) => {