fix our handling of snode sending errors so we have a real error shown

when a message fails to send because of it.

Also, fix the retry logic on the corresponding message
pull/1244/head
Audric Ackermann 5 years ago
parent 53433261d9
commit f641b9436b
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -1087,6 +1087,9 @@
}
const { body, attachments, preview, quote } = await this.uploadData();
const ourNumber = window.storage.get('primaryDevicePubKey');
const ourConversation = window.ConversationController.get(ourNumber);
const lokiProfile = ourConversation.getOurProfile();
const chatMessage = new libsession.Messages.Outgoing.ChatMessage({
identifier: this.id,
@ -1096,7 +1099,7 @@
attachments,
preview,
quote,
lokiProfile: this.conversation.getOurProfile(),
lokiProfile,
});
// Special-case the self-send case - we send only a sync message

@ -96,8 +96,9 @@ class LokiMessageAPI {
// eslint-disable-next-line more/no-then
snode = await primitives.firstTrue(promises);
} catch (e) {
const snodeStr = snode ? `${snode.ip}:${snode.port}` : 'null';
log.warn(
`loki_message:::sendMessage - ${e.code} ${e.message} to ${pubKey} via ${snode.ip}:${snode.port}`
`loki_message:::sendMessage - ${e.code} ${e.message} to ${pubKey} via snode:${snodeStr}`
);
if (e instanceof textsecure.WrongDifficultyError) {
// Force nonce recalculation

@ -298,8 +298,6 @@ export async function storeOnNode(
return false;
}
const res = snodeRes as any;
const json = JSON.parse(snodeRes.body);
// Make sure we aren't doing too much PoW
const currentDifficulty = window.storage.get('PoWDifficulty', null);

Loading…
Cancel
Save