From 74f352b36578630a5446c2351eda030089a9f39a Mon Sep 17 00:00:00 2001 From: Matthew <40522069+matthew4850@users.noreply.github.com> Date: Tue, 24 May 2022 14:08:36 +0100 Subject: [PATCH 1/2] Fix error because I'm an idiot. --- src/API/Discord.API/Gateways/Gateway.Sockets.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/API/Discord.API/Gateways/Gateway.Sockets.cs b/src/API/Discord.API/Gateways/Gateway.Sockets.cs index 7d0ed1d0c..1669747aa 100644 --- a/src/API/Discord.API/Gateways/Gateway.Sockets.cs +++ b/src/API/Discord.API/Gateways/Gateway.Sockets.cs @@ -66,7 +66,7 @@ public async Task ResumeAsync() private async Task ListenOnSocket() { var buffer = new ArraySegment(new byte[16 * 1024]); - while (_tokenSource.IsCancellationRequested && _socket!.State == WebSocketState.Open) + while (!_tokenSource.IsCancellationRequested && _socket!.State == WebSocketState.Open) { WebSocketReceiveResult socketResult = await _socket.ReceiveAsync(buffer, _tokenSource.Token).ConfigureAwait(false); if (socketResult.MessageType == WebSocketMessageType.Close) From cdb8f6aa6f69efb5ee8b0e69f7049004add353f8 Mon Sep 17 00:00:00 2001 From: Matthew <40522069+matthew4850@users.noreply.github.com> Date: Tue, 24 May 2022 14:20:03 +0100 Subject: [PATCH 2/2] Improve log in tracking. --- src/Quarrel.ViewModels/Services/Discord/DiscordService.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Quarrel.ViewModels/Services/Discord/DiscordService.cs b/src/Quarrel.ViewModels/Services/Discord/DiscordService.cs index f3394cec9..9208ab5a4 100644 --- a/src/Quarrel.ViewModels/Services/Discord/DiscordService.cs +++ b/src/Quarrel.ViewModels/Services/Discord/DiscordService.cs @@ -25,6 +25,7 @@ public partial class DiscordService : IDiscordService private readonly ILocalizationService _localizationService; private readonly IDispatcherService _dispatcherService; private readonly IMessenger _messenger; + private LoginType? _loginSource; /// /// Initializes a new instance of the class. @@ -66,11 +67,9 @@ public async Task LoginAsync(string token, LoginType source = LoginType.Un try { + _loginSource = source; await _quarrelClient.LoginAsync(token); - _analyticsService.Log(LoggedEvent.SuccessfulLogin, - (nameof(source), $"{source}")); - return true; } catch (Exception e) @@ -87,6 +86,8 @@ public async Task LoginAsync(string token, LoginType source = LoginType.Un private void OnLoggedIn(object sender, SelfUser e) { + _analyticsService.Log(LoggedEvent.SuccessfulLogin, (nameof(_loginSource), $"{_loginSource}")); + string? token = _quarrelClient.Token; Guard.IsNotNull(token, nameof(token));