/// <inheritdoc /> public bool TryRegisterSession(int accountId, out int sessionId) { if (_activeAccounts.ContainsKey(accountId)) { sessionId = 0; return(false); } else { sessionId = _currentSessionId.Increment(); var account = new ActiveAccount(accountId, sessionId); account.KeepAlive(_clock.Now); _activeAccounts.Add(accountId, account); return(true); } }
/// <inheritdoc /> public bool TryRegisterSession(int accountId, out int sessionId) { if (this.activeAccounts.ContainsKey(accountId)) { sessionId = 0; return false; } else { sessionId = this.currentSessionId.Increment(); var account = new ActiveAccount(accountId, sessionId); account.KeepAlive(this.clock.Now); this.activeAccounts.Add(accountId, account); return true; } }