on master help sign in
Cleaner -> InternalInfo.
commitda33d04e494d65b4b8463875912a11dfa23e87f1 authorKazu Yamamoto <kazu@iij.ad.jp> dateMon 14 Oct 2013, 15:57 (13 years ago) parentdba41d8
4 files changed+17−17
warp/Network/Wai/Handler/Warp.hs+1−1 warp/Network/Wai/Handler/Warp/Response.hs+8−8 warp/Network/Wai/Handler/Warp/Run.hs+7−7 warp/Network/Wai/Handler/Warp/Types.hs+1−1
warp/Network/Wai/Handler/Warp.hs+1−1
@@ -48,7 +48,7 @@ module Network.Wai.Handler.Warp (
4848 -- ** Time out manager
4949 , module Network.Wai.Handler.Warp.Timeout
5050 -- ** Data types
51− , Cleaner
51+ , InternalInfo
5252 -- ** Request and response
5353 , parseRequest
5454 , sendResponse
warp/Network/Wai/Handler/Warp/Response.hs+8−8
@@ -36,18 +36,18 @@ import Numeric (showInt)
3636----------------------------------------------------------------
3737
3838sendResponse :: Settings
39− -> Cleaner -> Request -> Connection
39+ -> InternalInfo -> Request -> Connection
4040 -> (forall a. IO a -> IO a) -- ^ restore masking state
4141 -> Response
4242 -> IO Bool
4343
4444----------------------------------------------------------------
4545
46−sendResponse settings cleaner req conn restore (ResponseFile s0 hs0 path mpart0) =
46+sendResponse settings ii req conn restore (ResponseFile s0 hs0 path mpart0) =
4747 restore $ headerAndLength >>= sendResponse'
4848 where
4949 hs = addAccept hs0
50− th = threadHandle cleaner
50+ th = threadHandle ii
5151 headerAndLength = liftIO . try $ do
5252 (hadLength, cl) <-
5353 case readInt <$> checkLength hs of
@@ -98,13 +98,13 @@ sendResponse settings cleaner req conn restore (ResponseFile s0 hs0 path mpart0)
9898 (isPersist,_) = infoFromRequest req
9999
100100 sendResponse' (Left (_ :: SomeException)) =
101− sendResponse settings cleaner req conn restore notFound
101+ sendResponse settings ii req conn restore notFound
102102 where
103103 notFound = responseLBS H.status404 [(H.hContentType, "text/plain")] "File not found"
104104
105105----------------------------------------------------------------
106106
107−sendResponse settings cleaner req conn restore (ResponseBuilder s hs b)
107+sendResponse settings ii req conn restore (ResponseBuilder s hs b)
108108 | hasBody s req = restore $ do
109109 header <- composeHeaderBuilder settings version s hs needsChunked
110110 let body
@@ -120,14 +120,14 @@ sendResponse settings cleaner req conn restore (ResponseBuilder s hs b)
120120 T.tickle th
121121 return isPersist
122122 where
123− th = threadHandle cleaner
123+ th = threadHandle ii
124124 version = httpVersion req
125125 reqinfo@(isPersist,_) = infoFromRequest req
126126 (isKeepAlive, needsChunked) = infoFromResponse hs reqinfo
127127
128128----------------------------------------------------------------
129129
130−sendResponse settings cleaner req conn restore (ResponseSource s hs withBodyFlush)
130+sendResponse settings ii req conn restore (ResponseSource s hs withBodyFlush)
131131 | hasBody s req = withBodyFlush $ \bodyFlush -> restore $ do
132132 header <- liftIO $ composeHeaderBuilder settings version s hs needsChunked
133133 let src = CL.sourceList [header] `mappend` cbody bodyFlush
@@ -138,7 +138,7 @@ sendResponse settings cleaner req conn restore (ResponseSource s hs withBodyFlus
138138 T.tickle th
139139 return isPersist
140140 where
141− th = threadHandle cleaner
141+ th = threadHandle ii
142142 cbody bodyFlush =
143143 if needsChunked then body $= chunk else body
144144 where
warp/Network/Wai/Handler/Warp/Run.hs+7−7
@@ -172,7 +172,7 @@ runSettingsConnectionMaker set getConnMaker app = do
172172 -- We need to register a timeout handler for this thread, and
173173 -- cancel that handler as soon as we exit.
174174 bracket (T.registerKillThread tm) T.cancel $ \th ->
175− let cleaner = Cleaner th fc
175+ let ii = InternalInfo th fc
176176 conn = setSendFile conn' fc
177177 -- We now have fully registered a connection close handler
178178 -- in the case of all exceptions, so it is safe to one
@@ -186,7 +186,7 @@ runSettingsConnectionMaker set getConnMaker app = do
186186 bracket_ onOpen onClose $
187187
188188 -- Actually serve this connection.
189− serveConnection th set cleaner app conn addr
189+ serveConnection th set ii app conn addr
190190 where
191191 -- FIXME: only IOEception is caught. What about other exceptions?
192192 getConnLoop = getConnMaker `E.catch` \(e :: IOException) -> do
@@ -209,15 +209,15 @@ runSettingsConnectionMaker set getConnMaker app = do
209209
210210serveConnection :: T.Handle
211211 -> Settings
212− -> Cleaner
212+ -> InternalInfo
213213 -> Application -> Connection -> SockAddr-> IO ()
214−serveConnection timeoutHandle settings cleaner app conn remoteHost' =
214+serveConnection timeoutHandle settings ii app conn remoteHost' =
215215 (serveConnection'' $ connSource conn th) `onException` send500
216216 where
217− th = threadHandle cleaner
217+ th = threadHandle ii
218218
219219 send500 = void $ mask $ \restore ->
220− sendResponse settings cleaner dummyreq conn restore internalError
220+ sendResponse settings ii dummyreq conn restore internalError
221221
222222 dummyreq = defaultRequest { remoteHost = remoteHost' }
223223
@@ -236,7 +236,7 @@ serveConnection timeoutHandle settings cleaner app conn remoteHost' =
236236 keepAlive <- mask $ \restore -> do
237237 res <- restore $ app env
238238 liftIO $ T.resume th
239− sendResponse settings cleaner env conn restore res
239+ sendResponse settings ii env conn restore res
240240
241241 -- We just send a Response and it takes a time to
242242 -- receive a Request again. If we immediately call recv,
warp/Network/Wai/Handler/Warp/Types.hs+1−1
@@ -68,7 +68,7 @@ data Connection = Connection
6868----------------------------------------------------------------
6969
7070-- | A type used to clean up file descriptor caches.
71−data Cleaner = Cleaner {
71+data InternalInfo = InternalInfo {
7272 threadHandle :: T.Handle
7373 , fdCacher :: Maybe F.MutableFdCache
7474 }