public void OnConnectionBroken(object sender, WampSessionCloseEventArgs eventArgs) { // TODO: clean up topics mPendingSubscriptions.ConnectionClosed(eventArgs); mPendingUnsubscriptions.ConnectionClosed(eventArgs); Cleanup(); }
private void OnSessionClosed(object sender, WampSessionCloseEventArgs e) { long sessionId = e.SessionId; IImmutableList <Testament> testaments; lock (mLock) { if (mSessionIdToTestaments.TryGetValue(sessionId, out testaments)) { mSessionIdToTestaments.Remove(sessionId); } } if (testaments != null) { foreach (Testament testament in testaments) { mTopicContainer.Publish(testament.PublishOptions, testament.Topic, testament.Arguments, testament.ArgumentsKeywords); } } }
private void OnConnectionBroken(object sender, WampSessionCloseEventArgs e) { if (e.CloseType != SessionCloseType.Disconnection) { var subscriptions = new string[ActiveSubscriptions.Count]; var i = 0; foreach (var subjectName in ActiveSubscriptions.Keys) { subscriptions[i] = subjectName; i++; } ActiveSubscriptions.Clear(); // Re-initialize WampChannel Start(); // Re-subscribe to subjects #pragma warning disable 4014 for (var j = subscriptions.Length - 1; j >= 0; j--) { var subjectName = subscriptions[j]; switch (subjectName) { case SubjectNameTicker: SubscribeToTickerAsync(); break; case SubjectNameTrollbox: SubscribeToTrollboxAsync(); break; } } #pragma warning restore 4014 } }
public void ConnectionClosed(WampSessionCloseEventArgs eventArgs) { WampConnectionBrokenException exception = new WampConnectionBrokenException(eventArgs); SetException(exception); }
private void OnSessionClosed(object sender, WampSessionCloseEventArgs e) { WampSessionDetails sessionDetails; ImmutableInterlocked.TryRemove(ref mSessionIdToDetails, e.SessionId, out sessionDetails); mSubscriber.OnLeave(e.SessionId); }
private void OnConnectionBroken(object sender, WampSessionCloseEventArgs e) { Exception exception = new WampConnectionBrokenException(e); SetException(exception); mDisconnectionTaskCompletionSource = new TaskCompletionSource <Exception>(); mDisconnectionWaitHandle = new ManualResetEvent(false); }
private async void OnConnectionBroken(object sender, WampSessionCloseEventArgs e) { IsConnected = false; if (e.CloseType != SessionCloseType.Disconnection) { OnSessionError?.Invoke(this, $"Reconnecting the broken session ({e.Reason ?? "no details provided"})"); await Restart(); } }
protected virtual void OnConnectionBroken(WampSessionCloseEventArgs e) { EventHandler <WampSessionCloseEventArgs> handler = ConnectionBroken; if (handler != null) { handler(this, e); } }
private void OnConnectionBroken(object sender, WampSessionCloseEventArgs e) { _isConnected = false; // Allow disconnecton, but re-initialize connection in case of any other reason if (e.CloseType != SessionCloseType.Disconnection) { Restart(); } }
private void TrySetCloseEventArgs(SessionCloseType sessionCloseType, GoodbyeAbortDetails details = null, string reason = null) { if (mCloseEventArgs == null) { mCloseEventArgs = new WampSessionCloseEventArgs (sessionCloseType, mSession, details, reason); } }
private void OnConnectionBroken(object sender, WampSessionCloseEventArgs e) { // Allow disconnecton, but re-initialize connection in case of any other reason if (e.CloseType == SessionCloseType.Disconnection) { return; } // Re-initialize connection Stop(); Start(); }
private static string GetExceptionMessage(WampSessionCloseEventArgs eventArgs) { string result = $"Connection got broken. CloseType:{eventArgs.CloseType}"; string reason = eventArgs.Reason; if (reason != null) { result = $"{result}, Reason: {reason}"; } return(result); }
private void RaiseConnectionBroken() { TrySetCloseEventArgs(SessionCloseType.Disconnection); WampSessionCloseEventArgs closeEventArgs = mCloseEventArgs; SetOpenTaskErrorIfNeeded(new WampConnectionBrokenException(mCloseEventArgs)); Interlocked.CompareExchange(ref mIsConnected, 0, 1); mOpenTask = new TaskCompletionSource <bool>(); mCloseEventArgs = null; OnConnectionBroken(closeEventArgs); }
private static string GetExceptionMessage(WampSessionCloseEventArgs eventArgs) { string result = string.Format("Connection got broken. CloseType:{0}", eventArgs.CloseType); string reason = eventArgs.Reason; if (reason != null) { result = string.Format("{0}, Reason: {1}", result, reason); } return(result); }
private void RaiseConnectionBroken(SessionCloseType sessionCloseType, GoodbyeAbortDetails details, string reason) { mConnectionBrokenRaised = true; WampSessionCloseEventArgs closeEventArgs = new WampSessionCloseEventArgs (sessionCloseType, mSession, details, reason); SetOpenTaskErrorIfNeeded(new WampConnectionBrokenException(closeEventArgs)); Interlocked.CompareExchange(ref mIsConnected, 0, 1); OnConnectionBroken(closeEventArgs); }
private void OnConnectionBroken(object sender, WampSessionCloseEventArgs e) { Console.WriteLine("OnConnectionBroken CALLED"); try { foreach (var subscription in ActiveSubscriptions.Values) { subscription.Dispose(); } ActiveSubscriptions.Clear(); PoloniexBot.Trading.Manager.Stop(); PoloniexBot.Trading.Manager.ClearAllPairs(); } catch (Exception ex) { Console.WriteLine("WAMP EXCEPTION (OnConnectionBroken): " + ex.Message); } }
private void OnConnectionBroken(object sender, WampSessionCloseEventArgs e) { if (e.CloseType != SessionCloseType.Disconnection) { var subscriptions = new string[ActiveSubscriptions.Count]; var i = 0; foreach (var subjectName in ActiveSubscriptions.Keys) { subscriptions[i] = subjectName; i++; } ActiveSubscriptions.Clear(); try { // Re-initialize WampChannel Start(); // Re-subscribe to subjects #pragma warning disable 4014 for (var j = subscriptions.Length - 1; j >= 0; j--) { var subjectName = subscriptions[j]; switch (subjectName) { case SubjectNameTicker: SubscribeToTickerAsync(); break; case SubjectNameTrollbox: SubscribeToTrollboxAsync(); break; } } #pragma warning restore 4014 } catch (Exception ex) { Console.WriteLine("Live OnConnectionBroken: " + ex.Message); PoloniexBot.CLI.Manager.PrintError(ex.Message); } } }
private void OnSessionClosed(object sender, WampSessionCloseEventArgs e) { long sessionId = e.SessionId; lock (mLock) { if (mSessionIdToDetails.TryGetValue(sessionId, out var details)) { mSessionIdToDetails = mSessionIdToDetails.Remove(sessionId); WelcomeDetails welcomeDetails = details.WelcomeDetails; mAuthIdToTerminator = TryRemoveAuthData(mAuthIdToTerminator, welcomeDetails?.AuthenticationId, details.Terminator); mAuthRoleToTerminator = TryRemoveAuthData(mAuthRoleToTerminator, welcomeDetails?.AuthenticationRole, details.Terminator); } } }
private void RaiseConnectionBroken() { TrySetCloseEventArgs(SessionCloseType.Disconnection); WampSessionCloseEventArgs closeEventArgs = mCloseEventArgs; Interlocked.CompareExchange(ref mIsConnected, 0, 1); GoodbyeMessage goodbyeMessage = mGoodbyeMessage; if (goodbyeMessage != null) { mCloseTask?.TrySetResult(goodbyeMessage); } SetTasksErrorsIfNeeded(new WampConnectionBrokenException(mCloseEventArgs)); mOpenTask = new TaskCompletionSource <bool>(); mCloseTask = null; mCloseEventArgs = null; mGoodbyeMessage = null; OnConnectionBroken(closeEventArgs); }
private static void OnClose(object sender, WampSessionCloseEventArgs e) { Console.WriteLine("connection closed. reason: " + e.Reason); }
public void OnConnectionBroken(object sender, WampSessionCloseEventArgs eventArgs) { mPendingRegistrations.ConnectionClosed(eventArgs); mPendingUnregistrations.ConnectionClosed(eventArgs); Cleanup(); }
public WampConnectionBrokenException(WampSessionCloseEventArgs eventArgs) : base(GetExceptionMessage(eventArgs)) { mEventArgs = eventArgs; }
private static void OnClose(object sender, WampSessionCloseEventArgs e) { Debug.WriteLine("connection closed. reason: " + e.Reason); }
private void OnConnectionBroken(object sender, WampSessionCloseEventArgs e) { Exception exception = new WampConnectionBrokenException(e); SetException(exception); }
private static void Realm_SessionClosed(object sender, WampSessionCloseEventArgs e) { Console.Out.WriteLine(JsonConvert.SerializeObject(e)); }
private static void SessionRemoved(object sender, WampSessionCloseEventArgs e) { Log.LogVerbose(nameof(WampRouter), "A connection error occured"); }
private static void ConnectionBroken(object sender, WampSessionCloseEventArgs e) { Console.WriteLine("disconnected {0}", e.Reason); }
public void OnConnectionBroken(object sender, WampSessionCloseEventArgs wampSessionCloseEventArgs) { Cleanup(); }
private static void OnClose(object sender, WampSessionCloseEventArgs e) { WampBackend.Instance.IsConnected = false; Console.WriteLine("WAMP connection broken."); }
protected virtual void OnConnectionBroken(WampSessionCloseEventArgs e) { ConnectionBroken?.Invoke(this, e); }
private void OnConnectionBroken(object sender, WampSessionCloseEventArgs e) { Dispose(); }