diff options
-rw-r--r-- | dht-client.cabal | 4 | ||||
-rw-r--r-- | src/Network/BitTorrent/DHT/ContactInfo.hs | 2 | ||||
-rw-r--r-- | src/Network/Kademlia/Search.hs | 3 | ||||
-rw-r--r-- | src/Network/Tox/Crypto/Handlers.hs | 3 |
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 | ||
184 | isSwarmOccupied :: SwarmData -> Bool | ||
184 | isSwarmOccupied SwarmData{..} = not $ PSQ.null peers | 185 | isSwarmOccupied SwarmData{..} = not $ PSQ.null peers |
185 | 186 | ||
186 | -- | Empty store. | 187 | -- | Empty store. |
@@ -207,6 +208,7 @@ instance Serialize PeerStore where | |||
207 | lookup :: InfoHash -> PeerStore -> [PeerAddr] | 208 | lookup :: InfoHash -> PeerStore -> [PeerAddr] |
208 | lookup ih (PeerStore m) = maybe [] (PSQ.keys . peers) $ HM.lookup ih m | 209 | lookup ih (PeerStore m) = maybe [] (PSQ.keys . peers) $ HM.lookup ih m |
209 | 210 | ||
211 | batchSize :: Int | ||
210 | batchSize = 64 | 212 | batchSize = 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 | |||
18 | import Data.Maybe | 18 | import Data.Maybe |
19 | import qualified Data.Set as Set | 19 | import qualified Data.Set as Set |
20 | ;import Data.Set (Set) | 20 | ;import Data.Set (Set) |
21 | import Data.Hashable (Hashable(..)) -- for type sigs | ||
21 | import System.IO | 22 | import System.IO |
22 | import System.IO.Error | 23 | import 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 | ||
177 | searchLoop :: ( 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 () | ||
176 | searchLoop sch@Search{..} target result s@SearchState{..} = do | 179 | searchLoop 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 | |||
20 | import GHC.Conc (unsafeIOToSTM) | 20 | import GHC.Conc (unsafeIOToSTM) |
21 | 21 | ||
22 | -- util, todo: move to another module | 22 | -- util, todo: move to another module |
23 | maybeToEither :: Maybe b -> Either String b | ||
23 | maybeToEither (Just x) = Right x | 24 | maybeToEither (Just x) = Right x |
24 | maybeToEither Nothing = Left "maybeToEither" | 25 | maybeToEither 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 | 205 | cryptoDefaultHooks :: Map.Map MessageType [NetCryptoHook] | |
205 | cryptoDefaultHooks = Map.empty | 206 | cryptoDefaultHooks = Map.empty |