1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-27 17:56:19 +00:00

Added ConfigureAwait(false) in socket connections

This commit is contained in:
JKorf 2018-03-12 10:32:27 +01:00
parent 7996fa4c20
commit d0177248c8
2 changed files with 5 additions and 3 deletions

View File

@ -7,7 +7,7 @@
<PropertyGroup> <PropertyGroup>
<PackageId>CryptoExchange.Net</PackageId> <PackageId>CryptoExchange.Net</PackageId>
<Authors>JKorf</Authors> <Authors>JKorf</Authors>
<PackageVersion>0.0.10</PackageVersion> <PackageVersion>0.0.11</PackageVersion>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance> <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageProjectUrl>https://github.com/JKorf/CryptoExchange.Net</PackageProjectUrl> <PackageProjectUrl>https://github.com/JKorf/CryptoExchange.Net</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/JKorf/CryptoExchange.Net/blob/master/LICENSE</PackageLicenseUrl> <PackageLicenseUrl>https://github.com/JKorf/CryptoExchange.Net/blob/master/LICENSE</PackageLicenseUrl>

View File

@ -30,6 +30,8 @@ namespace CryptoExchange.Net.Implementation
public BaseSocket(string url, IDictionary<string, string> cookies, IDictionary<string, string> headers) public BaseSocket(string url, IDictionary<string, string> cookies, IDictionary<string, string> headers)
{ {
socket = new WebSocket(url, cookies: cookies.ToList(), customHeaderItems: headers.ToList()); socket = new WebSocket(url, cookies: cookies.ToList(), customHeaderItems: headers.ToList());
socket.EnableAutoSendPing = true;
socket.AutoSendPingInterval = 10;
socket.Opened += (o, s) => Handle(openhandlers); socket.Opened += (o, s) => Handle(openhandlers);
socket.Closed += (o, s) => Handle(closehandlers); socket.Closed += (o, s) => Handle(closehandlers);
socket.Error += (o, s) => Handle(errorhandlers, s.Exception); socket.Error += (o, s) => Handle(errorhandlers, s.Exception);
@ -79,7 +81,7 @@ namespace CryptoExchange.Net.Implementation
socket.Close(); socket.Close();
evnt.WaitOne(); evnt.WaitOne();
socket.Closed -= handler; socket.Closed -= handler;
}); }).ConfigureAwait(false);
} }
public void Send(string data) public void Send(string data)
@ -100,7 +102,7 @@ namespace CryptoExchange.Net.Implementation
socket.Opened -= handler; socket.Opened -= handler;
socket.Closed -= handler; socket.Closed -= handler;
return socket.State == WebSocketState.Open; return socket.State == WebSocketState.Open;
}); }).ConfigureAwait(false);
} }
public void SetEnabledSslProtocols(SslProtocols protocols) public void SetEnabledSslProtocols(SslProtocols protocols)