pull/930/head
Audric Ackermann 5 years ago
parent 06aeb126c2
commit 0528a4c8ac
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -217,7 +217,12 @@ class LokiMessageAPI {
}
return true;
} catch (e) {
log.warn('Loki send message error:', e.code, e.message, `from ${address}`);
log.warn(
'Loki send message error:',
e.code,
e.message,
`from ${address}`
);
if (e instanceof textsecure.WrongSwarmError) {
const { newSwarm } = e;
await lokiSnodeAPI.updateSwarmNodes(params.pubKey, newSwarm);

@ -70,7 +70,10 @@ const sendToProxy = async (options = {}, targetNode) => {
// detect SNode is not ready (not in swarm; not done syncing)
if (response.status === 503) {
const ciphertext = await response.text();
log.error(`lokiRpc sendToProxy snode ${randSnode.ip}:${randSnode.port} error`, ciphertext);
log.error(
`lokiRpc sendToProxy snode ${randSnode.ip}:${randSnode.port} error`,
ciphertext
);
// mark as bad for this round (should give it some time and improve success rates)
lokiSnodeAPI.markRandomNodeUnreachable(randSnode);
// retry for a new working snode
@ -104,7 +107,7 @@ const sendToProxy = async (options = {}, targetNode) => {
const textDecoder = new TextDecoder();
plaintext = textDecoder.decode(plaintextBuffer);
} catch(e) {
} catch (e) {
log.error(
'lokiRpc sendToProxy decode error',
e.code,

@ -31,7 +31,10 @@ class LokiSnodeAPI {
];
}
async initialiseRandomPool(seedNodes = [...window.seedNodeList], consecutiveErrors = 0) {
async initialiseRandomPool(
seedNodes = [...window.seedNodeList],
consecutiveErrors = 0
) {
const params = {
limit: 20,
active_only: true,
@ -71,7 +74,10 @@ class LokiSnodeAPI {
if (consecutiveErrors < 3) {
// retry after a possible delay
setTimeout(() => {
log.info('Retrying initialising random snode pool, try #', consecutiveErrors);
log.info(
'Retrying initialising random snode pool, try #',
consecutiveErrors
);
this.initialiseRandomPool(seedNodes, consecutiveErrors + 1);
}, consecutiveErrors * consecutiveErrors * 5000);
} else {
@ -181,7 +187,12 @@ class LokiSnodeAPI {
const snodes = result.snodes.filter(tSnode => tSnode.ip !== '0.0.0.0');
return snodes;
} catch (e) {
log.error('getSnodesForPubkey error', e.code, e.message, `for ${snode.ip}:${snode.port}`);
log.error(
'getSnodesForPubkey error',
e.code,
e.message,
`for ${snode.ip}:${snode.port}`
);
this.markRandomNodeUnreachable(snode);
return [];
}
@ -197,7 +208,9 @@ class LokiSnodeAPI {
const resList = await this.getSnodesForPubkey(rSnode, pubKey);
// should we only activate entries that are in all results?
resList.map(item => {
const hasItem = snodes.some(hItem => item.ip === hItem.ip && item.port === hItem.port);
const hasItem = snodes.some(
hItem => item.ip === hItem.ip && item.port === hItem.port
);
if (!hasItem) {
snodes.push(item);
}

@ -59,7 +59,10 @@ function MessageReceiver(username, password, signalingKey, options = {}) {
lokiPublicChatAPI.removeAllListeners('publicMessage');
// we only need one MR in the system handling these
// bind events
lokiPublicChatAPI.on('publicMessage', this.handleUnencryptedMessage.bind(this));
lokiPublicChatAPI.on(
'publicMessage',
this.handleUnencryptedMessage.bind(this)
);
openGroupBound = true;
}
} else {

@ -95,7 +95,11 @@ export class CreateGroupDialog extends React.Component<Props, State> {
);
return (
<SessionModal title={titleText} onClose={this.closeDialog} onOk={() => null}>
<SessionModal
title={titleText}
onClose={this.closeDialog}
onOk={() => null}
>
<div className="spacer-lg" />
<p className={errorMessageClasses}>{this.state.errorMessage}</p>

Loading…
Cancel
Save