fix socket error
This commit is contained in:
parent
d76447400d
commit
acc0e12f1d
3 changed files with 5 additions and 4 deletions
|
@ -5,4 +5,4 @@ setSpawnerProbability : 0.01
|
|||
setFPS : 30
|
||||
setClientMaxTimeout : 5
|
||||
setFramesPerPing : 120
|
||||
setLogLevel : Verbose
|
||||
setLogLevel : Info
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue