diff --git a/src/net45/WampSharp/WAMP2/V2/Client/Session/WampSessionClient.cs b/src/net45/WampSharp/WAMP2/V2/Client/Session/WampSessionClient.cs index 18f57b576..cebb9e607 100644 --- a/src/net45/WampSharp/WAMP2/V2/Client/Session/WampSessionClient.cs +++ b/src/net45/WampSharp/WAMP2/V2/Client/Session/WampSessionClient.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using WampSharp.Core.Listener; @@ -125,6 +124,10 @@ private void RaiseConnectionBroken(SessionCloseType sessionCloseType, GoodbyeAbo Interlocked.CompareExchange(ref mIsConnected, 0, 1); + mOpenTask = new TaskCompletionSource(); + + mConnectionBrokenRaised = false; + OnConnectionBroken(closeEventArgs); } @@ -192,9 +195,6 @@ public void OnConnectionClosed() null, null); } - - mConnectionBrokenRaised = false; - mOpenTask = new TaskCompletionSource(); } public void OnConnectionError(Exception exception)