diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-12-24 12:07:15 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-12-24 12:07:15 -0400 |
commit | 22252e8e4c1bc17b9ce63f3e69c4ac73f1412969 (patch) | |
tree | 78aa6b9aa26f5625b74305ee5198a3c3d72aacb4 /RemoteDaemon | |
parent | 3aaabc906b776075e190739b42157959b4e09f31 (diff) |
Revert "close"
This reverts commit 3aaabc906b776075e190739b42157959b4e09f31.
Commit contained incomplete work.
Diffstat (limited to 'RemoteDaemon')
-rw-r--r-- | RemoteDaemon/Transport/Tor.hs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/RemoteDaemon/Transport/Tor.hs b/RemoteDaemon/Transport/Tor.hs index 43ff3a2c1b..0fbe9a7200 100644 --- a/RemoteDaemon/Transport/Tor.hs +++ b/RemoteDaemon/Transport/Tor.hs @@ -48,8 +48,22 @@ server th@(TransportHandle (LocalRepo r) _) = do replicateM_ maxConnections $ forkIO $ forever $ serveClient th u r q + nukeFile sock + soc <- S.socket S.AF_UNIX S.Stream S.defaultProtocol + S.bind soc (S.SockAddrUnix sock) + -- Allow everyone to read and write to the socket; tor + -- is probably running as a different user. + -- Connections have to authenticate to do anything, + -- so it's fine that other local users can connect to the + -- socket. + modifyFileMode sock $ addModes + [groupReadMode, groupWriteMode, otherReadMode, otherWriteMode] + + S.listen soc 2 debugM "remotedaemon" "Tor hidden service running" - serveUnixSocket sock $ \conn -> do + forever $ do + (conn, _) <- S.accept soc + h <- setupHandle conn ok <- atomically $ ifM (isFullTBMQueue q) ( return False , do |