@@ -186,13 +186,13 @@ acceptConnection set getConnMaker app dc fc tm = mask_ $ do
186186 -- We grab the connection before registering timeouts since the
187187 -- timeouts will be useless during connection creation, due to the
188188 -- fact that async exceptions are still masked.
189− bracket mkConn (connClose . fst) $ \(conn', isSecure') ->
189+ bracket mkConn closeConn $ \(conn0, isSecure') ->
190190
191191 -- We need to register a timeout handler for this thread, and
192192 -- cancel that handler as soon as we exit.
193193 bracket (T.registerKillThread tm) T.cancel $ \th ->
194194 let ii = InternalInfo th fc dc
195− conn = setSendFile conn' fc
195+ conn = setSendFile conn0 fc
196196 -- We now have fully registered a connection close handler
197197 -- in the case of all exceptions, so it is safe to one
198198 -- again allow async exceptions.
@@ -202,7 +202,7 @@ acceptConnection set getConnMaker app dc fc tm = mask_ $ do
202202 handle (onE Nothing) .
203203
204204 -- Call the user-supplied code for connection open and close events
205− bracket (onOpen addr) (const $ onClose addr) $ \goingon ->
205+ bracket (onOpen addr) (onClose addr) $ \goingon ->
206206
207207 -- Actually serve this connection.
208208 -- onnClose above ensures the termination of the connection.
@@ -223,8 +223,10 @@ acceptConnection set getConnMaker app dc fc tm = mask_ $ do
223223 Just (NotEnoughLines []) -> return ()
224224 _ -> settingsOnException set mreq e
225225
226+ closeConn (conn, _isSecure) = connClose conn
227+
226228 onOpen = settingsOnOpen set
227− onClose = settingsOnClose set
229+ onClose addr _ = settingsOnClose set addr
228230
229231serveConnection :: Connection
230232 -> InternalInfo