redone backend handling and config parsing

This commit is contained in:
Dennis Frieberg 2021-03-18 15:31:59 +01:00
parent 4733c3e3e2
commit c4a1a442f3
9 changed files with 177 additions and 166 deletions

View file

@ -77,6 +77,7 @@ clientLogic conn sessionStateMVar = do
hPrint stderr msg
)
-- the next line is a bit ugly, maybe there is a better way?
-- maybe refactor, so that the request Handler can choose to lock or not. -- TODO
(\request -> modifyMVar_ sessionStateMVar (\sessionState -> requestHandler conn sessionState request))
(decodeStrict msg :: Maybe TL.JSONRequest)
clientLogic conn sessionStateMVar
@ -102,7 +103,7 @@ requestHandler conn (tl, pl, cls, sem) (TL.InitializeTickLeisteR preTickLeiste)
-- TODO
-- Also TickLeisteR must be inside the modifyMVar, because we use the MVar also as a lock, and we can't
-- have changes between reading the TickLeiste and sending it.
-- have changes between reading the TickLeiste and sending the information.
requestHandler conn ss@(tl, pl, cls, sem) TL.TickLeisteR = do
sendClientEvent (TL.InitializeTickLeisteE $ tickLeisteToPlayerList pl tl) conn
return ss