summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dht-client.cabal4
-rw-r--r--src/Network/BitTorrent/DHT/ContactInfo.hs2
-rw-r--r--src/Network/Kademlia/Search.hs3
-rw-r--r--src/Network/Tox/Crypto/Handlers.hs3
4 files changed, 8 insertions, 4 deletions
diff --git a/dht-client.cabal b/dht-client.cabal
index 36b9b4f7..0c9b4e3c 100644
--- a/dht-client.cabal
+++ b/dht-client.cabal
@@ -175,9 +175,7 @@ library
175 build-depends: bytestring >= 0.9, bytestring-builder 175 build-depends: bytestring >= 0.9, bytestring-builder
176 else 176 else
177 build-depends: bytestring >= 0.10 177 build-depends: bytestring >= 0.10
178 if impl(ghc < 7.6) 178 ghc-options: -fwarn-missing-signatures -fdefer-typed-holes
179 build-depends: ghc-prim
180 ghc-options: -fdefer-typed-holes
181 ghc-prof-options: 179 ghc-prof-options:
182 180
183 181
diff --git a/src/Network/BitTorrent/DHT/ContactInfo.hs b/src/Network/BitTorrent/DHT/ContactInfo.hs
index 89c2ec17..c8187772 100644
--- a/src/Network/BitTorrent/DHT/ContactInfo.hs
+++ b/src/Network/BitTorrent/DHT/ContactInfo.hs
@@ -181,6 +181,7 @@ swarmInsert new old = SwarmData
181 where 181 where
182 newerTimeStamp newtime oldtime = if newtime > oldtime then newtime else oldtime 182 newerTimeStamp newtime oldtime = if newtime > oldtime then newtime else oldtime
183 183
184isSwarmOccupied :: SwarmData -> Bool
184isSwarmOccupied SwarmData{..} = not $ PSQ.null peers 185isSwarmOccupied SwarmData{..} = not $ PSQ.null peers
185 186
186-- | Empty store. 187-- | Empty store.
@@ -207,6 +208,7 @@ instance Serialize PeerStore where
207lookup :: InfoHash -> PeerStore -> [PeerAddr] 208lookup :: InfoHash -> PeerStore -> [PeerAddr]
208lookup ih (PeerStore m) = maybe [] (PSQ.keys . peers) $ HM.lookup ih m 209lookup ih (PeerStore m) = maybe [] (PSQ.keys . peers) $ HM.lookup ih m
209 210
211batchSize :: Int
210batchSize = 64 212batchSize = 64
211 213
212-- | Used in 'get_peers' DHT queries. 214-- | Used in 'get_peers' DHT queries.
diff --git a/src/Network/Kademlia/Search.hs b/src/Network/Kademlia/Search.hs
index 71107fbd..770d2f13 100644
--- a/src/Network/Kademlia/Search.hs
+++ b/src/Network/Kademlia/Search.hs
@@ -18,6 +18,7 @@ import qualified Data.Map.Strict as Map
18import Data.Maybe 18import Data.Maybe
19import qualified Data.Set as Set 19import qualified Data.Set as Set
20 ;import Data.Set (Set) 20 ;import Data.Set (Set)
21import Data.Hashable (Hashable(..)) -- for type sigs
21import System.IO 22import System.IO
22import System.IO.Error 23import System.IO.Error
23 24
@@ -173,6 +174,8 @@ search sch buckets target result = do
173 fork $ searchLoop sch target result st 174 fork $ searchLoop sch target result st
174 return st 175 return st
175 176
177searchLoop :: ( Ord addr, Ord nid, Ord ni, Show nid, Hashable nid, Hashable ni )
178 => Search nid addr tok ni r -> nid -> (r -> STM Bool) -> SearchState nid addr tok ni r -> IO ()
176searchLoop sch@Search{..} target result s@SearchState{..} = do 179searchLoop sch@Search{..} target result s@SearchState{..} = do
177 myThreadId >>= flip labelThread ("search."++show target) 180 myThreadId >>= flip labelThread ("search."++show target)
178 withTaskGroup ("search.g."++show target) searchAlpha $ \g -> fix $ \again -> do 181 withTaskGroup ("search.g."++show target) searchAlpha $ \g -> fix $ \again -> do
diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs
index 089a991d..8a45ba64 100644
--- a/src/Network/Tox/Crypto/Handlers.hs
+++ b/src/Network/Tox/Crypto/Handlers.hs
@@ -20,6 +20,7 @@ import Data.Word
20import GHC.Conc (unsafeIOToSTM) 20import GHC.Conc (unsafeIOToSTM)
21 21
22-- util, todo: move to another module 22-- util, todo: move to another module
23maybeToEither :: Maybe b -> Either String b
23maybeToEither (Just x) = Right x 24maybeToEither (Just x) = Right x
24maybeToEither Nothing = Left "maybeToEither" 25maybeToEither Nothing = Left "maybeToEither"
25 26
@@ -201,5 +202,5 @@ cryptoNetHandler sessions addr (NetCrypto (CryptoPacket nonce16 encrypted)) = do
201 _ -> error "unreachable-last2Bytes" 202 _ -> error "unreachable-last2Bytes"
202 dATA_NUM_THRESHOLD = 21845 -- = 65535 / 3 203 dATA_NUM_THRESHOLD = 21845 -- = 65535 / 3
203 204
204 205cryptoDefaultHooks :: Map.Map MessageType [NetCryptoHook]
205cryptoDefaultHooks = Map.empty 206cryptoDefaultHooks = Map.empty