summaryrefslogtreecommitdiff
path: root/src/Network/Kademlia.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2018-06-22 21:17:22 -0400
committerjoe <joe@jerkface.net>2018-06-22 21:17:22 -0400
commitf5f854c8144dc29086928a94b2ea86cfae0d0557 (patch)
tree5a7daccc1be66375edd35b238f348129f540b146 /src/Network/Kademlia.hs
parent6f040764654640730d3f832cf4e41174562718fb (diff)
Removed redundant imports and other clean up.
Diffstat (limited to 'src/Network/Kademlia.hs')
-rw-r--r--src/Network/Kademlia.hs24
1 files changed, 2 insertions, 22 deletions
diff --git a/src/Network/Kademlia.hs b/src/Network/Kademlia.hs
index 50c98967..44ef2ec1 100644
--- a/src/Network/Kademlia.hs
+++ b/src/Network/Kademlia.hs
@@ -6,11 +6,8 @@
6{-# LANGUAGE PatternSynonyms #-} 6{-# LANGUAGE PatternSynonyms #-}
7module Network.Kademlia where 7module Network.Kademlia where
8 8
9import Data.Function
10import Data.Maybe 9import Data.Maybe
11import qualified Data.Set as Set 10import Data.Time.Clock.POSIX
12import Data.Time.Clock (getCurrentTime)
13import Data.Time.Clock.POSIX (getPOSIXTime, utcTimeToPOSIXSeconds)
14import Network.Kademlia.Routing as R 11import Network.Kademlia.Routing as R
15#ifdef THREAD_DEBUG 12#ifdef THREAD_DEBUG
16import Control.Concurrent.Lifted.Instrument 13import Control.Concurrent.Lifted.Instrument
@@ -20,24 +17,7 @@ import GHC.Conc (labelThread)
20#endif 17#endif
21import Control.Concurrent.STM 18import Control.Concurrent.STM
22import Control.Monad 19import Control.Monad
23import Data.Bits
24import Data.Hashable
25#if MIN_VERSION_iproute(1,7,4)
26import Data.IP hiding (fromSockAddr)
27#else
28import Data.IP
29#endif
30import Data.Monoid
31import Data.Serialize (Serialize)
32import Data.Time.Clock.POSIX (POSIXTime) 20import Data.Time.Clock.POSIX (POSIXTime)
33import Network.Address (bucketRange,genBucketSample)
34import Network.Kademlia.Search
35import System.Entropy
36import System.Timeout
37import Text.PrettyPrint as PP hiding (($$), (<>))
38import Text.PrettyPrint.HughesPJClass hiding (($$), (<>))
39import System.IO
40import Control.Concurrent.Tasks
41 21
42-- | The status of a given node with respect to a given routint table. 22-- | The status of a given node with respect to a given routint table.
43data RoutingStatus 23data RoutingStatus
@@ -147,7 +127,7 @@ accepted (_,y) = RoutingTransition y Accepted
147insertNode :: Kademlia nid ni -> ni -> IO () 127insertNode :: Kademlia nid ni -> ni -> IO ()
148insertNode (Kademlia reporter space io) node = do 128insertNode (Kademlia reporter space io) node = do
149 129
150 tm <- utcTimeToPOSIXSeconds <$> getCurrentTime 130 tm <- getPOSIXTime
151 131
152 (ps,reaction) <- atomically $ do 132 (ps,reaction) <- atomically $ do
153 tbl <- tblRead io 133 tbl <- tblRead io