moved retryCount before validating the session (#2167)
This commit is contained in:
@@ -431,12 +431,12 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
let shouldRecreateSession = false
|
||||
let recreateReason = ''
|
||||
|
||||
if (enableAutoSessionRecreation && messageRetryManager) {
|
||||
if (enableAutoSessionRecreation && messageRetryManager && retryCount > 1) {
|
||||
try {
|
||||
// Check if we have a session with this JID
|
||||
const sessionId = signalRepository.jidToSignalProtocolAddress(fromJid)
|
||||
const hasSession = await signalRepository.validateSession(fromJid)
|
||||
const result = messageRetryManager.shouldRecreateSession(fromJid, retryCount, hasSession.exists)
|
||||
const result = messageRetryManager.shouldRecreateSession(fromJid, hasSession.exists)
|
||||
shouldRecreateSession = result.recreate
|
||||
recreateReason = result.reason
|
||||
|
||||
@@ -989,12 +989,12 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
let shouldRecreateSession = false
|
||||
let recreateReason = ''
|
||||
|
||||
if (enableAutoSessionRecreation && messageRetryManager) {
|
||||
if (enableAutoSessionRecreation && messageRetryManager && retryCount > 1) {
|
||||
try {
|
||||
const sessionId = signalRepository.jidToSignalProtocolAddress(participant)
|
||||
|
||||
const hasSession = await signalRepository.validateSession(participant)
|
||||
const result = messageRetryManager.shouldRecreateSession(participant, retryCount, hasSession.exists)
|
||||
const result = messageRetryManager.shouldRecreateSession(participant, hasSession.exists)
|
||||
shouldRecreateSession = result.recreate
|
||||
recreateReason = result.reason
|
||||
|
||||
@@ -1179,7 +1179,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
|
||||
const encNode = getBinaryNodeChild(node, 'enc')
|
||||
// TODO: temporary fix for crashes and issues resulting of failed msmsg decryption
|
||||
if (encNode && encNode.attrs.type === 'msmsg') {
|
||||
if (encNode?.attrs.type === 'msmsg') {
|
||||
logger.debug({ key: node.attrs.key }, 'ignored msmsg')
|
||||
await sendMessageAck(node, NACK_REASONS.MissingMessageSecret)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user