summaryrefslogtreecommitdiff
path: root/src/server/MainFastCGI.hs
diff options
context:
space:
mode:
authorbjorn <bjorn@bringert.net>2008-10-17 14:12:53 +0000
committerbjorn <bjorn@bringert.net>2008-10-17 14:12:53 +0000
commit0205f341f5d817fcf3a43057db9d0ef2a23af98c (patch)
tree4366decc9c90f0d7e663499e787a122378b8e417 /src/server/MainFastCGI.hs
parenteb0fefec28cf9c089c55f1ef5de9c772faa61786 (diff)
(fastcgi) replace DataRef with a more general Cache type, which can hold several PGF grammars.
Diffstat (limited to 'src/server/MainFastCGI.hs')
-rw-r--r--src/server/MainFastCGI.hs16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/server/MainFastCGI.hs b/src/server/MainFastCGI.hs
index 059b26bb9..5f58787bd 100644
--- a/src/server/MainFastCGI.hs
+++ b/src/server/MainFastCGI.hs
@@ -2,6 +2,7 @@
import PGF (PGF)
import qualified PGF
+import Cache
import FastCGIUtils
import URLEncoding
@@ -17,17 +18,18 @@ import Data.Maybe
import System.Environment
-grammarFile :: IO FilePath
-grammarFile = do env <- getEnvironment
- return $ fromMaybe "grammar.pgf" $ lookup "PGF_FILE" env
+defaultGrammarFile :: IO FilePath
+defaultGrammarFile =
+ do env <- getEnvironment
+ return $ fromMaybe "grammar.pgf" $ lookup "PGF_FILE" env
main :: IO ()
main = do initFastCGI
- ref <- grammarFile >>= newDataRef PGF.readPGF
- runFastCGIConcurrent' forkIO 100 (handleErrors (handleCGIErrors (fcgiMain ref)))
+ cache <- newCache PGF.readPGF
+ runFastCGIConcurrent' forkIO 100 (handleErrors (handleCGIErrors (fcgiMain cache)))
-fcgiMain :: DataRef PGF -> CGI CGIResult
-fcgiMain ref = liftIO (getData ref) >>= cgiMain
+fcgiMain :: Cache PGF -> CGI CGIResult
+fcgiMain cache = liftIO (defaultGrammarFile >>= readCache cache) >>= cgiMain
cgiMain :: PGF -> CGI CGIResult
cgiMain pgf =