diff options
author | Joey Hess <joey@kitenet.net> | 2013-12-06 22:35:11 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-12-06 22:35:11 -0400 |
commit | 8cc000db77bf45541208786f830e77aab36b7962 (patch) | |
tree | 6a82b620a243381b976af4b5e41dabe5052e2d00 | |
parent | bd0e14f5d428a7144626c4a4d58f543fd29e271d (diff) |
try to use build-in yesod socket bind code on windows (mine seems to make t crash)
-rw-r--r-- | Utility/WebApp.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Utility/WebApp.hs b/Utility/WebApp.hs index 225021b2e..ce23da4bc 100644 --- a/Utility/WebApp.hs +++ b/Utility/WebApp.hs @@ -39,6 +39,9 @@ import Control.Concurrent #ifdef __ANDROID__ import Data.Endian #endif +#ifdef mingw32_HOST_OS +import Data.Conduit.Network (bindPort) +#endif import Network.Socket (withSocketsDo) localhost :: HostName @@ -70,7 +73,12 @@ browserProc url = proc "xdg-open" [url] -} runWebApp :: Maybe HostName -> Wai.Application -> (SockAddr -> IO ()) -> IO () runWebApp h app observer = withSocketsDo $ do +#ifndef mingw32_HOST_OS sock <- getSocket h +#else + let set = defaultSettings + sock <- bindPort (settingsPort set) (settingsHost set) +#endif void $ forkIO $ runSettingsSocket webAppSettings sock app sockaddr <- fixSockAddr <$> getSocketName sock observer sockaddr |