Example #1
0
        public void ChangeState(AbstractState newState)
        {
            if (_currentState != null)
                _currentState.Exit();

            _currentState = newState;
            _currentState.Enter();
        }
Example #2
0
        public void Dispose()
        {
            if (_transport != null)
                _transport.Shutdown();

            if (_persistedStore != null)
                _persistedStore.Dispose();

            _clients.Clear();

            _transport = null;
            _persistedStore = null;
            _currentState = null;
        }
Example #3
0
 public Server(int volume, IPEndPoint id, Log log, ITransport transport)
 {
     //_config = config;
     Volume = volume;
     _id = id;
     _random = new Random((int)DateTime.UtcNow.Ticks ^ _id.GetHashCode());
     //_dataDir = dataDir;
     _currentState = new StoppedState(this);
     _transport = transport;
     _persistedStore = log;
 }