From c5d669e4231c8431a10dbf94abcc423bb768831e Mon Sep 17 00:00:00 2001 From: Fabian Sauter Date: Thu, 27 Feb 2020 18:15:44 +0100 Subject: [PATCH] Fixed some crashes related to the new XMPP and TCP connection --- XMPP_API/Classes/Network/TCP/TcpConnection.cs | 2 +- XMPP_API/Classes/Network/XmppConnection.cs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/XMPP_API/Classes/Network/TCP/TcpConnection.cs b/XMPP_API/Classes/Network/TCP/TcpConnection.cs index f02e4036a..6eaa75ca6 100644 --- a/XMPP_API/Classes/Network/TCP/TcpConnection.cs +++ b/XMPP_API/Classes/Network/TCP/TcpConnection.cs @@ -335,7 +335,7 @@ private void CancelConnectionAttempt() { if (!disposed) { - connectCTS.Cancel(); + connectCTS?.Cancel(); } } diff --git a/XMPP_API/Classes/Network/XmppConnection.cs b/XMPP_API/Classes/Network/XmppConnection.cs index 8f9c56230..260c7e475 100644 --- a/XMPP_API/Classes/Network/XmppConnection.cs +++ b/XMPP_API/Classes/Network/XmppConnection.cs @@ -205,6 +205,8 @@ public async Task ConnectAsync() public async Task DisconnectAsync() { await CONNECT_DISCONNECT_SEMA.WaitAsync(); + holdConnection = false; + reconnectRequested = false; await InternalDisconnectAsync(); CONNECT_DISCONNECT_SEMA.Release(); }