diff options
author | Joey Hess <joey@kitenet.net> | 2014-04-20 15:30:39 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-04-20 15:30:39 -0400 |
commit | 619919bd49c342de60a63f16c835f0dd4acb9acb (patch) | |
tree | 534dc7c2f2a9bd53cf155b5bfaa9e14af1f64c0b | |
parent | 7ed6a5520cee91fc9ccd6105e938a3dd7b88dca0 (diff) |
send remote-daemon a RELOAD after making a ssh remote
This doesn't work yet, because RELOAD is buggy and does not notice the new
remote.
-rw-r--r-- | Assistant/Threads/RemoteControl.hs | 11 | ||||
-rw-r--r-- | RemoteDaemon/Types.hs | 3 |
2 files changed, 10 insertions, 4 deletions
diff --git a/Assistant/Threads/RemoteControl.hs b/Assistant/Threads/RemoteControl.hs index a886caeb9..317efe412 100644 --- a/Assistant/Threads/RemoteControl.hs +++ b/Assistant/Threads/RemoteControl.hs @@ -52,10 +52,12 @@ remoteControlThread = namedThread "RemoteControl" $ do remoteControllerThread :: Handle -> Assistant () remoteControllerThread toh = do clicker <- getAssistant remoteControl - liftIO $ forever $ do - msg <- readChan clicker - hPutStrLn toh $ unwords $ formatMessage msg - hFlush toh + forever $ do + msg <- liftIO $ readChan clicker + debug [show msg] + liftIO $ do + hPutStrLn toh $ unwords $ formatMessage msg + hFlush toh -- read status messages emitted by the remotedaemon and handle them remoteResponderThread :: Handle -> MVar (M.Map URI Remote) -> Assistant () @@ -63,6 +65,7 @@ remoteResponderThread fromh urimap = go M.empty where go syncalerts = do l <- liftIO $ hGetLine fromh + debug [l] case parseMessage l of Just (CONNECTED uri) -> changeconnected S.insert uri Just (DISCONNECTED uri) -> changeconnected S.delete uri diff --git a/RemoteDaemon/Types.hs b/RemoteDaemon/Types.hs index aff910120..0e44874d2 100644 --- a/RemoteDaemon/Types.hs +++ b/RemoteDaemon/Types.hs @@ -20,6 +20,7 @@ import Control.Concurrent -- The URI of a remote is used to uniquely identify it (names change..) newtype RemoteURI = RemoteURI URI + deriving (Show) -- A Transport for a particular git remote consumes some messages -- from a Chan, and emits others to another Chan. @@ -38,6 +39,7 @@ data Emitted | SYNCING RemoteURI | DONESYNCING RemoteURI Bool | WARNING RemoteURI String + deriving (Show) -- Messages that the deamon consumes. data Consumed @@ -47,6 +49,7 @@ data Consumed | CHANGED RefList | RELOAD | STOP + deriving (Show) type RefList = [Git.Ref] |