From e3253e79e3a8dfe274fa7e829b11c050029c3195 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Wed, 16 Jun 2010 18:00:09 +0200 Subject: Rewrote preview mode. Preview mode is now based on server requests instead of time intervals. This should solve some problems out there. --- src/Network/Hakyll/SimpleServer.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/Network') diff --git a/src/Network/Hakyll/SimpleServer.hs b/src/Network/Hakyll/SimpleServer.hs index f17c490..4eef689 100644 --- a/src/Network/Hakyll/SimpleServer.hs +++ b/src/Network/Hakyll/SimpleServer.hs @@ -188,8 +188,12 @@ respond handle = do -- | Start a simple http server on the given 'PortNumber', serving the given -- directory. -simpleServer :: PortNumber -> FilePath -> IO () -simpleServer port root = do +-- +simpleServer :: PortNumber -- ^ Port to listen on. + -> FilePath -- ^ Root directory to serve. + -> IO () -- ^ Optional pre-respond action. + -> IO () +simpleServer port root preRespond = do -- Channel to send logs to logChan <- newChan @@ -200,6 +204,7 @@ simpleServer port root = do -- When a client connects, respond in a separate thread. listen socket = do (handle, _, _) <- accept socket + preRespond forkIO (runReaderT (respond handle) config) -- Handle logging in a separate thread -- cgit v1.2.3