diff --git a/configuration.yaml b/configuration.yaml index 61ad583..f2ebd33 100644 --- a/configuration.yaml +++ b/configuration.yaml @@ -5,4 +5,4 @@ setSpawnerProbability : 0.01 setFPS : 30 setClientMaxTimeout : 5 setFramesPerPing : 120 -setLogLevel : Verbose +setLogLevel : Info diff --git a/src-server/Server/Communication.hs b/src-server/Server/Communication.hs index a5ccb1a..15598e0 100644 --- a/src-server/Server/Communication.hs +++ b/src-server/Server/Communication.hs @@ -122,7 +122,7 @@ processRequests = do receiverThreadId <- liftIO $ do t <- forkIO $ do threadDelay $ 10 ^ 6 - forever $ receiveMessage curLevel socketList queueList mainSocket serverQueue + forever $ receiveMessage curLevel socketList queueList sockContainer serverQueue logPrintIO curLevel Verbose "enabled listener thread" pure t senderThreadId <- liftIO $ do diff --git a/src-server/Server/Communication/Receive.hs b/src-server/Server/Communication/Receive.hs index 182bf75..b1dede2 100644 --- a/src-server/Server/Communication/Receive.hs +++ b/src-server/Server/Communication/Receive.hs @@ -33,13 +33,14 @@ receiveMessage :: LogLevel -> STM.TMVar [ClientSocket] -> STM.TMVar [ClientQueue] - -> Socket + -> STM.TMVar Socket -> STM.TQueue ClientMessage -> IO () -receiveMessage curLevel socketList queueList sock queue = do +receiveMessage curLevel socketList queueList sockContainer queue = do randSleep <- randomRIO (1, 1000) threadDelay randSleep let maxBufferLength = 4096 + sock <- STM.atomically $ STM.readTMVar sockContainer logPrintIO curLevel Verbose "read socket container for receiving" ptr <- mallocArray maxBufferLength logPrintIO curLevel Verbose "receiving data"