mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-04 13:19:48 +03:00
Make sure we close HTTP sockets on close (or reconfigure).
This commit is contained in:
parent
2e8defccc1
commit
06934959ca
@ -93,6 +93,9 @@ data Serv = Serv
|
|||||||
, sLoopTid :: Async ()
|
, sLoopTid :: Async ()
|
||||||
, sHttpTid :: Async ()
|
, sHttpTid :: Async ()
|
||||||
, sHttpsTid :: Maybe (Async ())
|
, sHttpsTid :: Maybe (Async ())
|
||||||
|
, sLoopSock :: Net.Socket
|
||||||
|
, sHttpSock :: Net.Socket
|
||||||
|
, sHttpsSock :: Net.Socket
|
||||||
, sPorts :: Ports
|
, sPorts :: Ports
|
||||||
, sPortsFile :: FilePath
|
, sPortsFile :: FilePath
|
||||||
, sLiveReqs :: TVar LiveReqs
|
, sLiveReqs :: TVar LiveReqs
|
||||||
@ -486,13 +489,19 @@ startServ isFake conf plan = do
|
|||||||
|
|
||||||
logDebug "Finished started HTTP Servers"
|
logDebug "Finished started HTTP Servers"
|
||||||
|
|
||||||
pure $ Serv sId conf loopTid httpTid httpsTid por fil liv
|
pure $ Serv sId conf
|
||||||
|
loopTid httpTid httpsTid
|
||||||
|
httpSock httpsSock loopSock
|
||||||
|
por fil liv
|
||||||
|
|
||||||
killServ :: HasLogFunc e => Serv -> RIO e ()
|
killServ :: HasLogFunc e => Serv -> RIO e ()
|
||||||
killServ Serv{..} = do
|
killServ Serv{..} = do
|
||||||
cancel sLoopTid
|
cancel sLoopTid
|
||||||
cancel sHttpTid
|
cancel sHttpTid
|
||||||
traverse_ cancel sHttpsTid
|
traverse_ cancel sHttpsTid
|
||||||
|
io $ Net.close sHttpSock
|
||||||
|
io $ Net.close sHttpsSock
|
||||||
|
io $ Net.close sLoopSock
|
||||||
removePortsFile sPortsFile
|
removePortsFile sPortsFile
|
||||||
(void . waitCatch) sLoopTid
|
(void . waitCatch) sLoopTid
|
||||||
(void . waitCatch) sHttpTid
|
(void . waitCatch) sHttpTid
|
||||||
|
Loading…
Reference in New Issue
Block a user