some polish
This commit is contained in:
parent
ff3fd6415f
commit
96b6db4755
5 changed files with 9 additions and 14 deletions
|
@ -4,4 +4,4 @@ setMapColumns : 40
|
||||||
setSpawnerProbability : 0.01
|
setSpawnerProbability : 0.01
|
||||||
setFPS : 60
|
setFPS : 60
|
||||||
setClientMaxTimeout : 5
|
setClientMaxTimeout : 5
|
||||||
setFramesPerPing : 5
|
setFramesPerPing : 30
|
||||||
|
|
12
flake.lock
12
flake.lock
|
@ -5,11 +5,11 @@
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1701680307,
|
"lastModified": 1710146030,
|
||||||
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -20,11 +20,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1701705699,
|
"lastModified": 1712489342,
|
||||||
"narHash": "sha256-h2HPYzcD1j7aNmomrWB0mrHULSO0jUji1Aw6hRAygvU=",
|
"narHash": "sha256-PbI6iD3TiXDRyqfdj5j1TyAIcCRLN7B7Umql33brfDs=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "4679e3657f53b39b7822eb7069abc13d6ffcdda1",
|
"rev": "dc8d832b21b6bd839c5d50bfe3b3846e4da9029a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -55,10 +55,6 @@ sendMessage st msg sock = do
|
||||||
msgVector
|
msgVector
|
||||||
(\ptr -> do
|
(\ptr -> do
|
||||||
void $ sendBuf sock ptr (VS.length msgVector)
|
void $ sendBuf sock ptr (VS.length msgVector)
|
||||||
-- eResult <- try $ sendBuf sock ptr (VS.length msgVector)
|
|
||||||
-- case eResult of
|
|
||||||
-- Left (_ :: IOException) -> gracefulExit st "sendMessage: Quitting due to connection loss…"
|
|
||||||
-- Right _ -> pure ()
|
|
||||||
)
|
)
|
||||||
|
|
||||||
handleMessages
|
handleMessages
|
||||||
|
@ -68,7 +64,7 @@ handleMessages = do
|
||||||
msgs <- liftIO $ STM.atomically $ STM.flushTQueue queue
|
msgs <- liftIO $ STM.atomically $ STM.flushTQueue queue
|
||||||
mapM_
|
mapM_
|
||||||
(\msg -> do
|
(\msg -> do
|
||||||
-- liftIO $ putStrLn $ "Handling following: " <> show msg
|
liftIO $ putStrLn $ "Handling following: " <> show msg
|
||||||
handleMessage msg
|
handleMessage msg
|
||||||
)
|
)
|
||||||
msgs
|
msgs
|
||||||
|
|
|
@ -32,7 +32,6 @@ runGame = do
|
||||||
(not . clientStop <$> (liftIO . STM.atomically . STM.readTMVar =<< gets scClientState))
|
(not . clientStop <$> (liftIO . STM.atomically . STM.readTMVar =<< gets scClientState))
|
||||||
(do
|
(do
|
||||||
handleMessages
|
handleMessages
|
||||||
pure ()
|
|
||||||
-- draw
|
-- draw
|
||||||
)
|
)
|
||||||
liftIO $ killThread recvThread
|
liftIO $ killThread recvThread
|
||||||
|
|
|
@ -215,7 +215,7 @@ handleMessage
|
||||||
handleMessage stateContainer readerContainer msg = do
|
handleMessage stateContainer readerContainer msg = do
|
||||||
let clientList = scClientSockets stateContainer
|
let clientList = scClientSockets stateContainer
|
||||||
clients <- liftIO $ STM.atomically $ STM.readTMVar clientList
|
clients <- liftIO $ STM.atomically $ STM.readTMVar clientList
|
||||||
-- putStrLn $ "Handling: " <> show msg
|
putStrLn $ "Handling: " <> show msg
|
||||||
case msg of
|
case msg of
|
||||||
IdRequest -> do
|
IdRequest -> do
|
||||||
clientId <- nextRandom
|
clientId <- nextRandom
|
||||||
|
|
Loading…
Reference in a new issue