@@ -80,7 +80,7 @@ allowInterrupt = unblock $ return ()
80run :: Port -> Application -> IO ()
80run :: Port -> Application -> IO ()
81run p = runSettings defaultSettings { settingsPort = p }
81run p = runSettings defaultSettings { settingsPort = p }
83−-- | Run a Warp server with the given settings.
83+-- | Run an 'Applicatoin' with the given 'Settings'.
84runSettings :: Settings -> Application -> IO ()
84runSettings :: Settings -> Application -> IO ()
85#if WINDOWS
85#if WINDOWS
86runSettings set app = withSocketsDo $ do
86runSettings set app = withSocketsDo $ do
@@ -119,6 +119,12 @@ runSettingsSocket set socket app =
119 conn <- socketConnection s
119 conn <- socketConnection s
120 return (conn, sa)
120 return (conn, sa)
122+-- | Allows you to provide a function which will return a 'Connection'. In
123+-- cases where creating the @Connection@ can be expensive, this allows the
124+-- expensive computations to be performed in a separate thread instead of the
122runSettingsConnection :: Settings -> IO (Connection, SockAddr) -> Application -> IO ()
128runSettingsConnection :: Settings -> IO (Connection, SockAddr) -> Application -> IO ()
123runSettingsConnection set getConn app = runSettingsConnectionMaker set getConnMaker app
129runSettingsConnection set getConn app = runSettingsConnectionMaker set getConnMaker app
@@ -126,12 +132,8 @@ runSettingsConnection set getConn app = runSettingsConnectionMaker set getConnMa
126 (conn, sa) <- getConn
132 (conn, sa) <- getConn
127 return (return conn, sa)
133 return (return conn, sa)
129−-- | Allows you to provide a function which will return a @Connection@. In
135+-- | Allows you to provide a function which will return a function
130−-- cases where creating the @Connection@ can be expensive, this allows the
136+-- which will return 'Connection'.
131−-- expensive computations to be performed in a separate thread instead of the
135runSettingsConnectionMaker :: Settings -> IO (IO Connection, SockAddr) -> Application -> IO ()
137runSettingsConnectionMaker :: Settings -> IO (IO Connection, SockAddr) -> Application -> IO ()
136runSettingsConnectionMaker set getConnMaker app = do
138runSettingsConnectionMaker set getConnMaker app = do
137#if SENDFILEFD
139#if SENDFILEFD