summaryrefslogtreecommitdiff
path: root/P2P
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-12-24 12:07:15 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-12-24 12:07:15 -0400
commiteb32db78ac832f38ba6d2bc1a8b1ddb6d038ab13 (patch)
tree1718cf2d32406547d3e56d96713a954d45fe14dd /P2P
parent6c089cff615bc44ca94cc4ca77dc69f281dd2ab8 (diff)
Revert "close"
This reverts commit 6c089cff615bc44ca94cc4ca77dc69f281dd2ab8. Commit contained incomplete work.
Diffstat (limited to 'P2P')
-rw-r--r--P2P/IO.hs29
1 files changed, 0 insertions, 29 deletions
diff --git a/P2P/IO.hs b/P2P/IO.hs
index 49f28bff1..3e0999775 100644
--- a/P2P/IO.hs
+++ b/P2P/IO.hs
@@ -68,35 +68,6 @@ closeConnection conn = do
hClose (connIhdl conn)
hClose (connOhdl conn)
--- Serves the protocol on a unix socket.
---
--- The callback is run to serve a connection, and is responsible for
--- closing the Handle when done.
---
--- Note that while the callback is running, other connections won't be
--- processes, so longterm work should be run in a separate thread by
--- the callback.
-serveUnixSocket :: FilePath -> (Handle -> IO ()) -> IO ()
-serveUnixSocket unixsocket serveconn = do
- nukeFile unixsocket
- soc <- S.socket S.AF_UNIX S.Stream S.defaultProtocol
- S.bind soc (S.SockAddrUnix unixsocket)
- -- Allow everyone to read and write to the socket,
- -- so a daemon like tor, that is probably running as a different
- -- de sock $ addModes
- -- user, can access it.
- --
- -- Connections have to authenticate to do anything,
- -- so it's fine that other local users can connect to the
- -- socket.
- modifyFileMode unixsocket $ addModes
- [groupReadMode, groupWriteMode, otherReadMode, otherWriteMode]
- S.listen soc 2
- forever $ do
- (conn, _) <- S.accept soc
- h <- setupHandle conn
- serveconn conn
-
setupHandle :: Socket -> IO Handle
setupHandle s = do
h <- socketToHandle s ReadWriteMode