1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-12 02:16:23 +00:00

updated resubscribing

This commit is contained in:
Jan Korf 2018-11-22 13:18:39 +01:00
parent 5c63941f32
commit 2478e4c7c7
3 changed files with 5 additions and 3 deletions

View File

@ -57,6 +57,6 @@ namespace CryptoExchange.Net.Objects
/// <summary> /// <summary>
/// Time to wait between reconnect attempts /// Time to wait between reconnect attempts
/// </summary> /// </summary>
public TimeSpan ReconnectInterval { get; set; } = TimeSpan.FromSeconds(2); public TimeSpan ReconnectInterval { get; set; } = TimeSpan.FromSeconds(5);
} }
} }

View File

@ -114,7 +114,9 @@ namespace CryptoExchange.Net
lock(sockets) lock(sockets)
subscription = sockets.Single(s => s.Socket == socket); subscription = sockets.Single(s => s.Socket == socket);
SocketReconnected(subscription, DateTime.UtcNow - socket.DisconnectTime.Value); if (!SocketReconnect(subscription, DateTime.UtcNow - socket.DisconnectTime.Value))
socket.Close().Wait(); // Close so we end up reconnecting again
return;
}); });
} }
else else

View File

@ -222,7 +222,7 @@ namespace CryptoExchange.Net.Sockets
lock (socketLock) lock (socketLock)
{ {
if (socket != null) if (socket != null)
log.Write(LogVerbosity.Debug, $"Socket {Id} sisposing websocket"); log.Write(LogVerbosity.Debug, $"Socket {Id} disposing websocket");
socket?.Dispose(); socket?.Dispose();
socket = null; socket = null;