From 5258f572d494d015c6c6e60c37a215bb95048bbd Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 6 Dec 2016 15:40:31 -0400 Subject: refactor --- RemoteDaemon/Transport/Tor.hs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'RemoteDaemon') diff --git a/RemoteDaemon/Transport/Tor.hs b/RemoteDaemon/Transport/Tor.hs index 2caa7cdb1..e5d4e97ad 100644 --- a/RemoteDaemon/Transport/Tor.hs +++ b/RemoteDaemon/Transport/Tor.hs @@ -15,7 +15,6 @@ import RemoteDaemon.Common import Utility.Tor import Utility.FileMode import Utility.AuthToken -import Remote.Helper.Tor import P2P.Protocol import P2P.IO import P2P.Annex @@ -55,7 +54,7 @@ server th@(TransportHandle (LocalRepo r) _) = do debugM "remotedaemon" "tor hidden service running" forever $ do (conn, _) <- accept soc - h <- torHandle conn + h <- setupHandle conn ok <- atomically $ ifM (isFullTBQueue q) ( return False , do @@ -85,16 +84,16 @@ serveClient th u r q = bracket setup cleanup go -- Load auth tokens for every connection, to notice -- when the allowed set is changed. allowed <- loadP2PAuthTokens - let runenv = RunEnv - { runRepo = r - , runCheckAuth = (`isAllowedAuthToken` allowed) - , runIhdl = h - , runOhdl = h + let conn = P2PConnection + { connRepo = r + , connCheckAuth = (`isAllowedAuthToken` allowed) + , connIhdl = h + , connOhdl = h } - v <- liftIO $ runNetProto runenv $ serveAuth u + v <- liftIO $ runNetProto conn $ serveAuth u case v of Just (Just theiruuid) -> void $ - runFullProto (Serving theiruuid) runenv $ + runFullProto (Serving theiruuid) conn $ serveAuthed u _ -> return () -- Merge the duplicated state back in. -- cgit v1.2.3