fix STOP
This commit is contained in:
parent
fa0cf81b26
commit
9a4a3bfb43
2 changed files with 6 additions and 10 deletions
|
@ -29,8 +29,6 @@ runForeground = do
|
||||||
ichan <- newChan :: IO (Chan Consumed)
|
ichan <- newChan :: IO (Chan Consumed)
|
||||||
ochan <- newChan :: IO (Chan Emitted)
|
ochan <- newChan :: IO (Chan Emitted)
|
||||||
|
|
||||||
void $ async $ controller ichan ochan
|
|
||||||
|
|
||||||
let reader = forever $ do
|
let reader = forever $ do
|
||||||
l <- getLine
|
l <- getLine
|
||||||
case parseMessage l of
|
case parseMessage l of
|
||||||
|
@ -40,18 +38,18 @@ runForeground = do
|
||||||
msg <- readChan ochan
|
msg <- readChan ochan
|
||||||
putStrLn $ unwords $ formatMessage msg
|
putStrLn $ unwords $ formatMessage msg
|
||||||
hFlush stdout
|
hFlush stdout
|
||||||
|
let controller = runController ichan ochan
|
||||||
|
|
||||||
-- If the reader or writer fails, for example because stdin/stdout
|
-- If any thread fails, the rest will be killed.
|
||||||
-- gets closed, kill the other one, and throw an exception which
|
void $ tryIO $
|
||||||
-- will take down the daemon.
|
reader `concurrently` writer `concurrently` controller
|
||||||
void $ concurrently reader writer
|
|
||||||
|
|
||||||
type RemoteMap = M.Map Git.Repo (IO (), Chan Consumed)
|
type RemoteMap = M.Map Git.Repo (IO (), Chan Consumed)
|
||||||
|
|
||||||
-- Runs the transports, dispatching messages to them, and handling
|
-- Runs the transports, dispatching messages to them, and handling
|
||||||
-- the main control messages.
|
-- the main control messages.
|
||||||
controller :: Chan Consumed -> Chan Emitted -> IO ()
|
runController :: Chan Consumed -> Chan Emitted -> IO ()
|
||||||
controller ichan ochan = do
|
runController ichan ochan = do
|
||||||
h <- genTransportHandle
|
h <- genTransportHandle
|
||||||
m <- genRemoteMap h ochan
|
m <- genRemoteMap h ochan
|
||||||
startrunning m
|
startrunning m
|
||||||
|
|
|
@ -160,8 +160,6 @@ No pushing is done for CHANGED, since git handles ssh natively.
|
||||||
|
|
||||||
TODO:
|
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,
|
* 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
|
ideally w/o generating network traffic. One way might be to check
|
||||||
if the ssh connection caching control socket exists, for example.
|
if the ssh connection caching control socket exists, for example.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue