예제 #1
0
        public override Task process(WatchedEvent @event)
        {
            if (@event.get_Type() != Event.EventType.None)
            {
                return(Task.CompletedTask);
            }

            var connectionEvent = new ConnectionEvent(@event, this);

            action(connectionEvent);

            return(Task.CompletedTask);
        }
예제 #2
0
        private void ProcessEvent(ConnectionEvent connectionEvent)
        {
            log.Debug("Processing connection state event '{ConnectionEvent}'.", connectionEvent);

            var currentState = state;

            if (currentState == null || !ReferenceEquals(connectionEvent.EventFrom, currentState.ConnectionWatcher))
            {
                return;
            }

            var newState = currentState.WithConnectionState(connectionEvent.NewConnectionState, settings);

            ChangeState(currentState, newState);
        }