public async Task <bool> LoginAsync(string username, string password) { if (Desynchronized) { return(false); } try { Interlocked.Increment(ref activeRequestCount); var authToken = await Auth.AuthenticateAsync(username, password); if (authToken != null) { currentAuthToken = authToken; tokenProvider.SetAuthToken(currentAuthToken); gameManager.OnAuthenticated(); return(true); } } catch (Exception exc) { logger.Error(exc.ToString()); } finally { Interlocked.Decrement(ref activeRequestCount); } return(false); }