[server] Adjust TreeModule structure

This commit prepares a slighly more powerful TreeModule structure: Now,
TreeModules can finish their execution, which should make some kinds of menus
and transitions possible.
This commit is contained in:
Joscha 2020-02-13 23:12:28 +00:00
parent d08f858692
commit 220b5a3234
4 changed files with 26 additions and 18 deletions

View file

@ -6,7 +6,6 @@ module Forest.Server
) where
import Control.Concurrent.Chan
import Control.Monad
import qualified Network.WebSockets as WS
import Forest.Api
@ -31,7 +30,7 @@ sendUpdatesThread conn nodeChan nodeA = do
{- Main server application that receives and processes client packets -}
receivePackets :: TreeModule a => WS.Connection -> a -> IO ()
receivePackets conn treeModule = forever $ do
receivePackets conn treeModule = whileM $ do
packet <- receivePacket conn
case packet of
ClientEdit path text -> do