summaryrefslogtreecommitdiff
path: root/Presence/LocalPeerCred.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2013-06-18 03:28:58 -0400
committerjoe <joe@jerkface.net>2013-06-18 03:28:58 -0400
commit946440e0ac31e8cb6b2fe873f27627d6d5fbd23f (patch)
tree32707609bd742910dd086bea87ee913aee1780c3 /Presence/LocalPeerCred.hs
parent74c5a3f6cf2404c4907b108699cda00eda0ccfb0 (diff)
cleanup debug noise
Diffstat (limited to 'Presence/LocalPeerCred.hs')
-rw-r--r--Presence/LocalPeerCred.hs13
1 files changed, 8 insertions, 5 deletions
diff --git a/Presence/LocalPeerCred.hs b/Presence/LocalPeerCred.hs
index ecd77dae..b544af97 100644
--- a/Presence/LocalPeerCred.hs
+++ b/Presence/LocalPeerCred.hs
@@ -11,7 +11,6 @@ import Data.Bits
11import Network.Socket 11import Network.Socket
12import System.Posix.Types 12import System.Posix.Types
13import Debug.Trace 13import Debug.Trace
14-- import System.Environment (getArgs)
15 14
16xs ?? n | n < 0 = Nothing 15xs ?? n | n < 0 = Nothing
17[] ?? _ = Nothing 16[] ?? _ = Nothing
@@ -34,7 +33,8 @@ parseHex bs = L.concat . parseHex' $ bs
34 33
35getLocalPeerCred' (SockAddrInet portn host) = do 34getLocalPeerCred' (SockAddrInet portn host) = do
36 let port = fromEnum portn 35 let port = fromEnum portn
37 trace ("tcp4 "++show(port,host)) $ withFile "/proc/net/tcp" ReadMode (parseProcNet port host) 36 {- trace ("tcp4 "++show(port,host)) $ -}
37 withFile "/proc/net/tcp" ReadMode (parseProcNet port host)
38 38
39getLocalPeerCred' (SockAddrInet6 portn flow host scope) = do 39getLocalPeerCred' (SockAddrInet6 portn flow host scope) = do
40 let port = fromEnum portn 40 let port = fromEnum portn
@@ -76,12 +76,15 @@ parseProcNet port host h = do
76 uid <- listToMaybe ys' 76 uid <- listToMaybe ys'
77 let peer = (port,decode addr) 77 let peer = (port,decode addr)
78 user = toEnum (read (unpack uid) ::Int) ::UserID -- CUid . fromIntegral $ (read (unpack uid)::Int) 78 user = toEnum (read (unpack uid) ::Int) ::UserID -- CUid . fromIntegral $ (read (unpack uid)::Int)
79 return $ trace ("peer:"++show(peer,user)) (peer,user) 79 return $ {- trace ("peer:"++show(peer,user)) -} (peer,user)
80 ) 80 )
81 fmap snd . listToMaybe $ filter ((===(port,host)).fst) rs 81 fmap snd . listToMaybe $ filter ((==(port,host)).fst) rs
82 trace ("found:"++show u) $ u `seq` return u 82 {- trace ("found: "++show u) -}
83 u `seq` return u
84{-
83 where 85 where
84 a === b = let r= a==b in trace ("Comparing "++show (a,b)++"-->"++show r) r 86 a === b = let r= a==b in trace ("Comparing "++show (a,b)++"-->"++show r) r
87-}
85 88
86{- 89{-
87main = do 90main = do