private async Task Sending() { try { IsSendingQueue = true; lock (SendTempQueueLock) { SendQueue.InsertRange(0, SendTempQueue); SendTempQueue.Clear(); } await SendAsync(PacketSerializer.Serialize(SendQueue, Key, Type == GSLiveType.Command)); } catch (Exception e) { e.LogException <GsTcpClient>( Type == GSLiveType.TurnBased ? DebugLocation.TurnBased : DebugLocation.Command, "Sending"); lock (SendTempQueueLock) { SendTempQueue.InsertRange(0, SendQueue); } } finally { IsSendingQueue = false; SendQueue.Clear(); } }