mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-07 16:06:15 +00:00
Fixed proxy setting not used on reconnecting socket
This commit is contained in:
parent
d451c18821
commit
2040b1c175
@ -31,6 +31,7 @@ namespace CryptoExchange.Net.Sockets
|
||||
private readonly IDictionary<string, string> cookies;
|
||||
private readonly IDictionary<string, string> headers;
|
||||
private CancellationTokenSource _ctsSource;
|
||||
private ApiProxy _proxy;
|
||||
|
||||
private readonly List<DateTime> _outgoingMessages;
|
||||
private DateTime _lastReceivedMessagesUpdate;
|
||||
@ -209,6 +210,8 @@ namespace CryptoExchange.Net.Sockets
|
||||
/// <inheritdoc />
|
||||
public virtual void SetProxy(ApiProxy proxy)
|
||||
{
|
||||
_proxy = proxy;
|
||||
|
||||
if (!Uri.TryCreate($"{proxy.Host}:{proxy.Port}", UriKind.Absolute, out var uri))
|
||||
throw new ArgumentException("Proxy settings invalid, {proxy.Host}:{proxy.Port} not a valid URI", nameof(proxy));
|
||||
|
||||
@ -339,6 +342,7 @@ namespace CryptoExchange.Net.Sockets
|
||||
while (_sendBuffer.TryDequeue(out _)) { } // Clear send buffer
|
||||
|
||||
_socket = CreateSocket();
|
||||
SetProxy(_proxy);
|
||||
_closed = false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user