/// <summary> /// Handles changes in data structure handler state /// </summary> /// <param name="sender"></param> /// <param name="arg"> /// Event argument which contains the new state /// </param> private void HandleConnectionStateChanged(object sender, RemoteSessionStateEventArgs arg) { using (s_trace.TraceEventHandlers()) { if (arg == null) { throw PSTraceSource.NewArgumentNullException("arg"); } if (arg.SessionStateInfo.State == RemoteSessionState.EstablishedAndKeyReceived) //TODO - Client session would never get into this state... to be removed { // send the public key StartKeyExchange(); } if (arg.SessionStateInfo.State == RemoteSessionState.ClosingConnection) { // when the connection is being closed we need to // complete the key exchange process to release // the lock under which the key exchange is happening // if we fail to release the lock, then when // transport manager is closing it will try to // acquire the lock again leading to a deadlock CompleteKeyExchange(); } StateChanged.SafeInvoke(this, arg); } }
private void OnConnectionStateChanged(object sender, PeerConnectionStateEventArgs e) { if (torrent != null && e.IsChoked) { torrent.OnPeerChokingUs(this); } StateChanged.SafeInvoke(this, e); }
/// <summary> /// Raises the StateChanged events which are queued /// All StateChanged events will be raised once the /// processing of the State Machine events are /// complete. /// </summary> private void RaiseStateMachineEvents() { RemoteSessionStateEventArgs queuedEventArg = null; while (_clientRemoteSessionStateChangeQueue.Count > 0) { queuedEventArg = _clientRemoteSessionStateChangeQueue.Dequeue(); StateChanged.SafeInvoke(this, queuedEventArg); } }
private void SaveState(string configurationId, int level, bool isManagerAssigned, int idleMining) { GameData.SetWorldObjectLevelData(configurationId, new WorldObjectLevelData { Id = configurationId, Level = level, IsManagerAssigned = isManagerAssigned, IdleMining = idleMining }); StateChanged.SafeInvoke(); }
public UserReceiveBundle(TwitterAccount account) { this._account = account; this._disposable = new CompositeDisposable { (this._userStreamsReceiver = new UserStreamsReceiver(account)), new HomeTimelineReceiver(account), new MentionTimelineReceiver(account), new DirectMessagesReceiver(account), new UserInfoReceiver(account), new UserTimelineReceiver(account), new UserRelationReceiver(account) }; this._userStreamsReceiver.StateChanged += () => StateChanged.SafeInvoke(account); }
internal void RaiseStateChangedEvent(PSInvocationStateChangedEventArgs args) { StateChanged.SafeInvoke(this, args); }
/// <summary> /// The state of the peer has been changed. /// </summary> protected virtual void OnStateChanged() { var eventArgs = new PeerConnectionStateEventArgs(IsInterestedByRemote, IsChokedByRemote); StateChanged.SafeInvoke(this, eventArgs); }