relayer receive loop is done

Receive loop looks right. Still need the send loop.

And, a complication is that some messages git-annex
sends need to be wrapped in REPLY_ASYNC, while others
do not. So will probably need to split externalSend
into two.
This commit is contained in:
Joey Hess 2020-08-12 15:54:30 -04:00
parent 06a4ab39fa
commit 15706e6991
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 73 additions and 46 deletions

View file

@ -615,7 +615,7 @@ startExternal external =
(st, extensions) <- startExternal' external
if asyncExtensionEnabled extensions
then do
v <- liftIO $ runRelayToExternalAsync st
v <- liftIO $ runRelayToExternalAsync external st
st' <- liftIO $ relayToExternalAsync v
store (ExternalAsync v)
return st'
@ -625,9 +625,9 @@ startExternal external =
v@NoExternalAsync -> do
store v
fst <$> startExternal' external
v@(ExternalAsync ExternalAsyncRelay) -> do
v@(ExternalAsync relay) -> do
store v
liftIO $ relayToExternalAsync v
liftIO $ relayToExternalAsync relay
where
store = liftIO . atomically . putTMVar (externalAsync external)
@ -677,7 +677,7 @@ startExternal' external = do
exwanted <- receiveMessage st external
(\resp -> case resp of
EXTENSIONS_RESPONSE l -> result l
UNSUPPORTED_REQUEST -> result []
UNSUPPORTED_REQUEST -> result mempty
_ -> Nothing
)
(const Nothing)