detect EOF on socket and cleanly shutdown the service process
This commit is contained in:
parent
483dbcdbef
commit
2da338bb8d
2 changed files with 3 additions and 2 deletions
|
@ -168,14 +168,14 @@ relayHelper runner v hin = loop
|
|||
return (Just exitcode)
|
||||
|
||||
-- Takes input from the peer, and puts it into the MVar for processing.
|
||||
-- Repeats until the peer tells it it's done.
|
||||
-- Repeats until the peer tells it it's done or hangs up.
|
||||
relayFeeder :: RunProto -> MVar RelayData -> IO ()
|
||||
relayFeeder runner v = loop
|
||||
where
|
||||
loop = do
|
||||
mrd <- runner $ net relayFromPeer
|
||||
case mrd of
|
||||
Nothing -> return ()
|
||||
Nothing -> putMVar v (RelayDone (ExitFailure 1))
|
||||
Just rd -> do
|
||||
putMVar v rd
|
||||
case rd of
|
||||
|
|
|
@ -47,3 +47,4 @@ server th@(TransportHandle (LocalRepo r) _) = do
|
|||
h <- torHandle conn
|
||||
_ <- runNetProtoHandle h h r (serve u)
|
||||
hClose h
|
||||
debugM "remotedaemon" "done handling a connection"
|
||||
|
|
Loading…
Reference in a new issue