Skip to content

Commit

Permalink
Update ev backend to the new backend API
Browse files Browse the repository at this point in the history
  • Loading branch information
John Lenz committed Nov 7, 2010
1 parent 03bbe1b commit 06e31e9
Show file tree
Hide file tree
Showing 4 changed files with 239 additions and 348 deletions.
4 changes: 2 additions & 2 deletions snap-server.cabal
Expand Up @@ -112,7 +112,8 @@ Library
Snap.Internal.Http.Server.GnuTLS,
Snap.Internal.Http.Server.HttpPort,
Snap.Internal.Http.Server.TimeoutTable,
Snap.Internal.Http.Server.SimpleBackend
Snap.Internal.Http.Server.SimpleBackend,
Snap.Internal.Http.Server.LibevBackend

build-depends:
array >= 0.2 && <0.4,
Expand Down Expand Up @@ -151,7 +152,6 @@ Library

if flag(libev)
build-depends: hlibev >= 0.2.8 && < 0.3
other-modules: Snap.Internal.Http.Server.LibevBackend
cpp-options: -DLIBEV

if flag(gnutls)
Expand Down
7 changes: 6 additions & 1 deletion src/Snap/Internal/Http/Server.hs
Expand Up @@ -46,6 +46,7 @@ import Snap.Internal.Http.Server.Backend
import Snap.Internal.Http.Server.HttpPort
import qualified Snap.Internal.Http.Server.GnuTLS as TLS
import Snap.Internal.Http.Server.SimpleBackend
import Snap.Internal.Http.Server.LibevBackend

import Snap.Internal.Iteratee.Debug
import Snap.Iteratee hiding (foldl', head, take, FileOffset)
Expand Down Expand Up @@ -76,7 +77,11 @@ data EventLoopType = EventLoopSimple
deriving (Prelude.Show)

defaultEvType :: EventLoopType
#ifdef LIBEV
defaultEvType = EventLoopLibEv
#else
defaultEvType = EventLoopSimple
#endif

data ServerState = ServerState
{ _forceConnectionClose :: Bool
Expand Down Expand Up @@ -150,7 +155,7 @@ httpServe ports mevType localHostname alogPath elogPath handler =

--------------------------------------------------------------------------
runEventLoop EventLoopSimple = simpleEventLoop
runEventLoop e = \_ _ _ _ -> throwIO $ PatternMatchFail $ Prelude.show e ++ " is not a supported backend"
runEventLoop EventLoopLibEv = libEvEventLoop


--------------------------------------------------------------------------
Expand Down

0 comments on commit 06e31e9

Please sign in to comment.