clean P2P protocol shutdown on EOF try 2
Same goal as b18fb1e343
but without
breaking backwards compatability. Just return IO exceptions when running
the P2P protocol, so that git-annex-shell can detect eof and avoid the
ugly message.
This commit was sponsored by Ethan Aubin.
This commit is contained in:
parent
80defa62c6
commit
6134431254
8 changed files with 70 additions and 45 deletions
|
@ -32,8 +32,9 @@ run (_remotename:address:[]) = forever $
|
|||
| otherwise = parseAddressPort address
|
||||
go service = do
|
||||
ready
|
||||
either giveup exitWith
|
||||
=<< connectService onionaddress onionport service
|
||||
connectService onionaddress onionport service >>= \case
|
||||
Right exitcode -> exitWith exitcode
|
||||
Left e -> giveup $ describeProtoFailure e
|
||||
ready = do
|
||||
putStrLn ""
|
||||
hFlush stdout
|
||||
|
@ -48,7 +49,7 @@ parseAddressPort s =
|
|||
Nothing -> giveup "onion address must include port number"
|
||||
Just p -> (OnionAddress a, p)
|
||||
|
||||
connectService :: OnionAddress -> OnionPort -> Service -> IO (Either String ExitCode)
|
||||
connectService :: OnionAddress -> OnionPort -> Service -> IO (Either ProtoFailure ExitCode)
|
||||
connectService address port service = do
|
||||
state <- Annex.new =<< Git.CurrentRepo.get
|
||||
Annex.eval state $ do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue