Skip to content

Commit

Permalink
rebroadcast to incoming peers even if there is an error broadcasting …
Browse files Browse the repository at this point in the history
…to outgoing peer.
  • Loading branch information
Cabecinha84 committed Jan 7, 2024
1 parent a6281de commit b24ab9b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ZelBack/src/services/fluxCommunication.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ async function handleAppMessages(message, fromIP, port) {
wsListOut.push(client);
}
});
fluxCommunicationMessagesSender.sendToAllPeers(messageString, wsListOut);
fluxCommunicationMessagesSender.sendToAllPeers(messageString, wsListOut).catch((error) => {
log.error(error);
});
await serviceHelper.delay(500);
const wsList = [];
incomingConnections.forEach((client) => {
Expand Down Expand Up @@ -124,7 +126,9 @@ async function handleAppRunningMessage(message, fromIP, port) {
wsListOut.push(client);
}
});
fluxCommunicationMessagesSender.sendToAllPeers(messageString, wsListOut);
fluxCommunicationMessagesSender.sendToAllPeers(messageString, wsListOut).catch((error) => {
log.error(error);
});
await serviceHelper.delay(500);
const wsList = [];
incomingConnections.forEach((client) => {
Expand Down Expand Up @@ -449,7 +453,9 @@ function connectedPeersInfo(req, res) {
*/
function keepConnectionsAlive() {
setInterval(() => {
fluxCommunicationMessagesSender.sendToAllPeers(); // perform ping
fluxCommunicationMessagesSender.sendToAllPeers().catch((error) => {
log.error(error);
}); // perform ping
fluxCommunicationMessagesSender.sendToAllIncomingConnections(); // perform ping
}, 15 * 1000);
}
Expand Down

0 comments on commit b24ab9b

Please sign in to comment.