Skip to content

Commit 79f2eab

Browse files
author
Ahmad Noman Musleh
committed
Added dispose call to connect method if connection fails
1 parent 517faf5 commit 79f2eab

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/OpenAPI.Net/OpenAPI.Net.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<PackageTags>cTrader, Open API, Spotware</PackageTags>
1010
<Description>A .NET RX library for Spotware Open API</Description>
1111
<PackageId>Spotware.OpenAPI.Net</PackageId>
12-
<Version>1.3.6</Version>
12+
<Version>1.3.7-rc0</Version>
1313
<Platforms>AnyCPU</Platforms>
1414
<Company>Spotware</Company>
1515
<Authors>Spotware</Authors>

src/OpenAPI.Net/OpenClient.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public OpenClient(string host, int port, TimeSpan heartbeatInerval, int maxReque
114114
/// Connects to the API based on you specified method (websocket or TCP)
115115
/// </summary>
116116
/// <exception cref="ObjectDisposedException">If client is disposed</exception>
117-
/// <exception cref="ConnectionException">If connection attempt failed</exception>
117+
/// <exception cref="ConnectionException">If connection attempt fails, the client will be disposed and this exception will be thrown</exception>
118118
/// <returns>Task</returns>
119119
public async Task Connect()
120120
{
@@ -138,6 +138,8 @@ public async Task Connect()
138138
}
139139
catch(Exception ex)
140140
{
141+
Dispose();
142+
141143
var connectionException = new ConnectionException(ex);
142144

143145
throw connectionException;

0 commit comments

Comments
 (0)