mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-07 07:56:12 +00:00
Fix for socket connection
This commit is contained in:
parent
0f949334f2
commit
73f7975ca7
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Security.Authentication;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using CryptoExchange.Net.Interfaces;
|
||||
using SuperSocket.ClientEngine.Proxy;
|
||||
@ -80,7 +81,15 @@ namespace CryptoExchange.Net
|
||||
|
||||
public async Task<bool> Connect()
|
||||
{
|
||||
return await socket.OpenAsync().ConfigureAwait(false);
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
ManualResetEvent evnt = new ManualResetEvent(false);
|
||||
socket.Opened += (o, s) => evnt.Set();
|
||||
socket.Closed += (o, s) => evnt.Set();
|
||||
socket.Open();
|
||||
evnt.WaitOne();
|
||||
return socket.State == WebSocketState.Open;
|
||||
});
|
||||
}
|
||||
|
||||
public void SetEnabledSslProtocols(SslProtocols protocols)
|
||||
|
@ -7,7 +7,7 @@
|
||||
<PropertyGroup>
|
||||
<PackageId>CryptoExchange.Net</PackageId>
|
||||
<Authors>JKorf</Authors>
|
||||
<PackageVersion>0.0.7</PackageVersion>
|
||||
<PackageVersion>0.0.8</PackageVersion>
|
||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||
<PackageProjectUrl>https://github.com/JKorf/CryptoExchange.Net</PackageProjectUrl>
|
||||
<PackageLicenseUrl>https://github.com/JKorf/CryptoExchange.Net/blob/master/LICENSE</PackageLicenseUrl>
|
||||
|
Loading…
x
Reference in New Issue
Block a user