summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-06-16 18:00:09 +0200
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-06-16 18:00:09 +0200
commite3253e79e3a8dfe274fa7e829b11c050029c3195 (patch)
treea3cff8ddc85940a314366ded8bdbdf2aa7082690 /src/Network
parentb1d4f48d2422b3604f8f8851e2930f800f85dc2c (diff)
downloadhakyll-e3253e79e3a8dfe274fa7e829b11c050029c3195.tar.gz
Rewrote preview mode.
Preview mode is now based on server requests instead of time intervals. This should solve some problems out there.
Diffstat (limited to 'src/Network')
-rw-r--r--src/Network/Hakyll/SimpleServer.hs9
1 files changed, 7 insertions, 2 deletions
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