diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-12-08 15:47:49 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-12-08 15:47:49 -0400 |
commit | faa56834d282c6bb9b3338ed7514f2e0665d166f (patch) | |
tree | c68477884041f5faa7ceb775cd79830ad48a5f5a /RemoteDaemon/Transport | |
parent | 1e7d212d4c0112e5b6b4872d84934fc85aa70315 (diff) |
convert P2P runners from Maybe to Either String
So we get some useful error messages when things fail.
This commit was sponsored by Peter Hogg on Patreon.
Diffstat (limited to 'RemoteDaemon/Transport')
-rw-r--r-- | RemoteDaemon/Transport/Tor.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/RemoteDaemon/Transport/Tor.hs b/RemoteDaemon/Transport/Tor.hs index e5d4e97ad..ab794a77e 100644 --- a/RemoteDaemon/Transport/Tor.hs +++ b/RemoteDaemon/Transport/Tor.hs @@ -92,10 +92,15 @@ serveClient th u r q = bracket setup cleanup go } v <- liftIO $ runNetProto conn $ serveAuth u case v of - Just (Just theiruuid) -> void $ + Right (Just theiruuid) -> void $ runFullProto (Serving theiruuid) conn $ serveAuthed u - _ -> return () + Right Nothing -> do + liftIO $ debugM "remotedaemon" "TOR connection failed to authenticate" + return () + Left e -> do + warning e + return () -- Merge the duplicated state back in. liftAnnex th $ mergeState st' debugM "remotedaemon" "done with TOR connection" |