Try to fix the reconnection system, but it's not working right.
This commit is contained in:
parent
19be6f8425
commit
216cd6d479
1 changed files with 13 additions and 7 deletions
|
@ -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()}.");
|
||||
Console.Error.WriteLine($"[Error] {e.Reason}: {e.Exception}");
|
||||
|
||||
Task.Delay(nextBackoffDelay * 1000).Wait();
|
||||
if (!connect().Result)
|
||||
nextBackoffDelay = (int)Math.Ceiling(nextBackoffDelay * backoffDelayMultiplier);
|
||||
else
|
||||
nextBackoffDelay = defaultBackoffDelay;
|
||||
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…
Reference in a new issue