From faa56834d282c6bb9b3338ed7514f2e0665d166f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 8 Dec 2016 15:47:49 -0400 Subject: 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. --- RemoteDaemon/Transport/Tor.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'RemoteDaemon') 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" -- cgit v1.2.3