Try to fix the reconnection system, but it's not working right.

master
Starbeamrainbowlabs 4 years ago
parent 19be6f8425
commit 216cd6d479
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
  1. 22
      RhinoReminds/ClientListener.cs

@ -107,14 +107,20 @@ namespace RhinoReminds
private void errorHandler(object sender, S22.Xmpp.Im.ErrorEventArgs e)
{
Console.Error.WriteLine($"Error {e.Reason}: {e.Exception}");
Console.Error.WriteLine($"Reconnecting in {TimeSpan.FromSeconds(nextBackoffDelay).ToString()}.");
Task.Delay(nextBackoffDelay * 1000).Wait();
if (!connect().Result)
nextBackoffDelay = (int)Math.Ceiling(nextBackoffDelay * backoffDelayMultiplier);
else
nextBackoffDelay = defaultBackoffDelay;
Console.Error.WriteLine($"[Error] {e.Reason}: {e.Exception}");
if(!client.Connected)
{
Console.Error.WriteLine($"[Error/Handler] Reconnecting in {TimeSpan.FromSeconds(nextBackoffDelay).ToString()}.");
Thread.Sleep(nextBackoffDelay * 1000);
Console.WriteLine("[Error/Handler] Attempting to reconnect to the server");
if (!connect().Result)
nextBackoffDelay = (int)Math.Ceiling(nextBackoffDelay * backoffDelayMultiplier);
else
nextBackoffDelay = defaultBackoffDelay;
}
}
private void messageHandlerRoot(object sender, MessageEventArgs eventArgs)

Loading…
Cancel
Save