fixed more bugs in backup ws and fixed readyState unchanged on onclose event error
This commit is contained in:
parent
bb7779c159
commit
9edaad678f
@ -11307,13 +11307,26 @@
|
|||||||
// ws conn already present
|
// ws conn already present
|
||||||
if (supsObj.trader_flo_address===currenctBackupWsList[z-1]) continue;
|
if (supsObj.trader_flo_address===currenctBackupWsList[z-1]) continue;
|
||||||
|
|
||||||
if (myClosestSupsFloList.indexOf(supsObj.trader_flo_address)
|
// Get the highest index of connected supernodes
|
||||||
<= myClosestSupsFloList.indexOf(currenctBackupWsList[z-1])) {
|
const highestIndexOfConnectedSupernode = Object.keys(localbitcoinplusplus.backupWS)
|
||||||
|
.reduce((acc, val) =>
|
||||||
|
(acc === undefined || myClosestSupsFloList.indexOf(val) > myClosestSupsFloList.indexOf(acc))
|
||||||
|
? myClosestSupsFloList.indexOf(val) : myClosestSupsFloList.indexOf(acc));
|
||||||
|
|
||||||
|
if (myClosestSupsFloList.indexOf(supsObj.trader_flo_address) < highestIndexOfConnectedSupernode) {
|
||||||
/* Break the loop as soon as this line runs
|
/* Break the loop as soon as this line runs
|
||||||
as any further ws conn releated event will be
|
as any further ws conn releated event will be
|
||||||
taken care in shift_ws_connection event itself. */
|
taken care in shift_ws_connection event itself. */
|
||||||
reactor.dispatchEvent('shift_ws_connection', supsObj);
|
reactor.dispatchEvent('shift_ws_connection', supsObj);
|
||||||
break;
|
break;
|
||||||
|
} else {
|
||||||
|
if (currenctBackupWsList.length
|
||||||
|
< localbitcoinplusplus.master_configurations.MaxBackups) {
|
||||||
|
|
||||||
|
reactor.dispatchEvent('shift_ws_connection', supsObj);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
reactor.dispatchEvent('shift_ws_connection', supsObj);
|
reactor.dispatchEvent('shift_ws_connection', supsObj);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user