summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-04-08 13:51:49 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-04-08 13:51:49 -0400
commitf2426676defafecc904234de3522f57ebf7ab19d (patch)
tree4b7b071b9f6029fb84d619a0df98454e3a7d1a32
parent6e47a1412175cbc00f44ea8dc663ad83331cfb6d (diff)
fix STOP
-rw-r--r--RemoteDaemon/Core.hs14
-rw-r--r--doc/design/git-remote-daemon.mdwn2
2 files changed, 6 insertions, 10 deletions
diff --git a/RemoteDaemon/Core.hs b/RemoteDaemon/Core.hs
index cd4a0aaed..a220e5807 100644
--- a/RemoteDaemon/Core.hs
+++ b/RemoteDaemon/Core.hs
@@ -29,8 +29,6 @@ runForeground = do
ichan <- newChan :: IO (Chan Consumed)
ochan <- newChan :: IO (Chan Emitted)
- void $ async $ controller ichan ochan
-
let reader = forever $ do
l <- getLine
case parseMessage l of
@@ -40,18 +38,18 @@ runForeground = do
msg <- readChan ochan
putStrLn $ unwords $ formatMessage msg
hFlush stdout
+ let controller = runController ichan ochan
- -- If the reader or writer fails, for example because stdin/stdout
- -- gets closed, kill the other one, and throw an exception which
- -- will take down the daemon.
- void $ concurrently reader writer
+ -- If any thread fails, the rest will be killed.
+ void $ tryIO $
+ reader `concurrently` writer `concurrently` controller
type RemoteMap = M.Map Git.Repo (IO (), Chan Consumed)
-- Runs the transports, dispatching messages to them, and handling
-- the main control messages.
-controller :: Chan Consumed -> Chan Emitted -> IO ()
-controller ichan ochan = do
+runController :: Chan Consumed -> Chan Emitted -> IO ()
+runController ichan ochan = do
h <- genTransportHandle
m <- genRemoteMap h ochan
startrunning m
diff --git a/doc/design/git-remote-daemon.mdwn b/doc/design/git-remote-daemon.mdwn
index ad41fa447..6b8e0646f 100644
--- a/doc/design/git-remote-daemon.mdwn
+++ b/doc/design/git-remote-daemon.mdwn
@@ -160,8 +160,6 @@ No pushing is done for CHANGED, since git handles ssh natively.
TODO:
-* It already detects changes and pulls, but it then dies with a protocol
- error.
* Remote system might not be available. Find a smart way to detect it,
ideally w/o generating network traffic. One way might be to check
if the ssh connection caching control socket exists, for example.