public void Dispatch() { if (!_isOperational) { return; } var current = _currentOperation ?? (_operations.Count > 0 ? _operations.Dequeue() : null); current = current ?? (_pendingOperationTypes.Count > 0 ? BuildOperation(_pendingOperationTypes.Dequeue()) : null); if (ReferenceEquals(null, current)) { return; } if (ReferenceEquals(null, _currentOperation)) { _currentOperation = current; _currentOperation.Execute(); return; } if (_currentOperation.IsComplete) { _currentOperation = null; } }
public void OnClientDisconnect() { _isOperational = false; _operations.Clear(); _pendingOperationTypes.Clear(); _currentOperation = null; }