internal override void StopReceiving(bool isGraceful) { try { IsAvailable = false; IsSendingQueue = false; DataBuilder?.Clear(); SendQueue?.Clear(); lock (SendTempQueueLock) { SendTempQueue?.Clear(); } SendQueueTimer?.Stop(); SendQueueTimer?.Close(); OperationCancellationToken?.Cancel(false); OperationCancellationToken?.Dispose(); _client?.Close(); } catch (Exception) { // ignored } finally { Key = null; _client = null; _clientStream = null; OperationCancellationToken = null; DataReceived = null; RecvThread = null; SendQueueTimer = null; try { GC.SuppressFinalize(this); } catch (Exception) { // ignored } DebugUtil.LogNormal <GsTcpClient>( Type == GSLiveType.TurnBased ? DebugLocation.TurnBased : DebugLocation.Command, "StopReceiving", "GsTcpClient -> StopReceiving Done"); } }
protected override void Suspend() { try { IsAvailable = false; IsSendingQueue = false; DataBuilder?.Clear(); SendQueueTimer?.Stop(); SendQueueTimer?.Close(); OperationCancellationToken?.Cancel(false); OperationCancellationToken?.Dispose(); _client?.Close(); } catch (Exception) { // ignored } finally { _client = null; _clientStream = null; OperationCancellationToken = null; RecvThread = null; SendQueueTimer = null; try { GC.SuppressFinalize(this); } catch (Exception) { // ignored } DebugUtil.LogNormal <GsTcpClient>( Type == GSLiveType.TurnBased ? DebugLocation.TurnBased : DebugLocation.Command, "Suspend", "GsTcpClient -> Suspend Done"); } }