aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hype
diff options
context:
space:
mode:
authorhackthetime <l4bg0jb7@duck.com>2023-10-05 13:48:56 +0200
committerhackthetime <l4bg0jb7@duck.com>2023-10-05 13:48:56 +0200
commit77b627252c4e22b28cfdf1aa561c621d1e8ca552 (patch)
tree1666652d5e6c07b7c37a132a487fa305fb0e1106 /src/main/java/de/hype
parent85d91f3a2575ebc70f2dd9f2afcc62782cf16813 (diff)
downloadBBsentials-77b627252c4e22b28cfdf1aa561c621d1e8ca552.tar.gz
BBsentials-77b627252c4e22b28cfdf1aa561c621d1e8ca552.tar.bz2
BBsentials-77b627252c4e22b28cfdf1aa561c621d1e8ca552.zip
bug fix for the Disconnect Packet not reconnecting.
added a custom random delay to the Packet to allow setting a custom delay time server side to reduce load at the reconnect time.
Diffstat (limited to 'src/main/java/de/hype')
-rw-r--r--src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java b/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java
index 1d11998..1d1e3c1 100644
--- a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java
+++ b/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java
@@ -412,15 +412,17 @@ public class BBsentialConnection {
public void onDisconnectPacket(DisconnectPacket packet) {
Chat.sendPrivateMessageToSelfError(packet.displayMessage);
- for (int i : packet.waitBeforeReconnect) {
+ BBsentials.connection = null;
+ for (int i = 0; i < packet.waitBeforeReconnect.length; i++) {
+ int finalI = i;
executionService.schedule(() -> {
- if (i == 1) {
+ if (finalI == 1) {
BBsentials.connectToBBserver();
}
else {
BBsentials.conditionalReconnectToBBserver();
}
- }, i, TimeUnit.SECONDS);
+ }, (long) (packet.waitBeforeReconnect[i] + (Math.random() * packet.random)), TimeUnit.SECONDS);
}
}