From 7834b737eb6b40c43d7866c1867aebde0fca3e72 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Tue, 8 Sep 2015 00:52:19 -0400 Subject: [PATCH] Added sleep to packet thread to avoid cpu consumption. --- FFXIVClassic_Lobby_Server/PacketProcessor.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/FFXIVClassic_Lobby_Server/PacketProcessor.cs b/FFXIVClassic_Lobby_Server/PacketProcessor.cs index 373e86f1..07e6d096 100644 --- a/FFXIVClassic_Lobby_Server/PacketProcessor.cs +++ b/FFXIVClassic_Lobby_Server/PacketProcessor.cs @@ -8,6 +8,7 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; namespace FFXIVClassic_Lobby_Server @@ -58,6 +59,12 @@ namespace FFXIVClassic_Lobby_Server client.flushQueuedSendPackets(); } } + + //Don't waste CPU if isn't needed + if (mConnections.Count == 0) + Thread.Sleep(2000); + else + Thread.Sleep(100); } }