From 2fee3e9d893973b3db7af606e6583d2ccd9d05eb Mon Sep 17 00:00:00 2001 From: Sam Truzjan Date: Thu, 20 Feb 2014 06:25:03 +0400 Subject: Fix some warnings --- src/Network/BitTorrent/Client.hs | 7 +++---- src/Network/BitTorrent/DHT.hs | 1 - tests/Network/BitTorrent/DHT/SessionSpec.hs | 2 +- tests/Network/BitTorrent/DHTSpec.hs | 4 +--- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Network/BitTorrent/Client.hs b/src/Network/BitTorrent/Client.hs index 7a50b6ba..349283c3 100644 --- a/src/Network/BitTorrent/Client.hs +++ b/src/Network/BitTorrent/Client.hs @@ -39,7 +39,6 @@ import Control.Exception import Control.Concurrent import Control.Monad.Logger import Control.Monad.Trans -import Control.Monad.Trans.Resource import Data.Default import Data.HashMap.Strict as HM @@ -84,15 +83,15 @@ exchangeOptions pid Options {..} = Exchange.Options , optBacklog = optBacklog def } ---connHandler :: HashMap InfoHash Handle -> Handler -connHandler tmap = undefined +connHandler :: MVar (HashMap InfoHash Handle) -> Exchange.Handler +connHandler _tmap = undefined newClient :: Options -> LogFun -> IO Client newClient opts @ Options {..} logger = do pid <- genPeerId tmap <- newMVar HM.empty tmgr <- Tracker.newManager def (PeerInfo pid Nothing optPort) - emgr <- Exchange.newManager (exchangeOptions pid opts) connHandler + emgr <- Exchange.newManager (exchangeOptions pid opts) (connHandler tmap) node <- do node <- startNode defaultHandlers def optNodeAddr logger runDHT node $ bootstrap (maybeToList optBootNode) diff --git a/src/Network/BitTorrent/DHT.hs b/src/Network/BitTorrent/DHT.hs index cdc5124b..ed42363f 100644 --- a/src/Network/BitTorrent/DHT.hs +++ b/src/Network/BitTorrent/DHT.hs @@ -55,7 +55,6 @@ module Network.BitTorrent.DHT import Control.Applicative import Control.Monad.Logger import Control.Monad.Reader -import Control.Monad.Trans import Control.Exception import Data.ByteString as BS import Data.Conduit as C diff --git a/tests/Network/BitTorrent/DHT/SessionSpec.hs b/tests/Network/BitTorrent/DHT/SessionSpec.hs index c936dd1b..41852763 100644 --- a/tests/Network/BitTorrent/DHT/SessionSpec.hs +++ b/tests/Network/BitTorrent/DHT/SessionSpec.hs @@ -64,7 +64,7 @@ spec = do property $ \ (nid :: NodeId) -> do let info = NodeInfo nid myAddr closest <- simpleDHT $ do - insertNode info + _ <- insertNode info liftIO $ yield getClosest nid closest `shouldSatisfy` L.elem info diff --git a/tests/Network/BitTorrent/DHTSpec.hs b/tests/Network/BitTorrent/DHTSpec.hs index a8248be2..76b48257 100644 --- a/tests/Network/BitTorrent/DHTSpec.hs +++ b/tests/Network/BitTorrent/DHTSpec.hs @@ -4,11 +4,9 @@ import Control.Monad import Data.Default import Data.List as L import Test.Hspec -import Test.QuickCheck import System.Timeout import Data.Torrent.InfoHash -import Network.BitTorrent.Core import Network.BitTorrent.DHT @@ -38,7 +36,7 @@ spec = do it "partial bootstrapping should finish in less than 10 seconds" $ do node <- resolveHostName (L.head defaultBootstrapNodes) res <- timeout partialBootstrapTimeout $ do - dht def def $ do + dht opts def $ do bootstrap [node] isBootstrapped res `shouldBe` Just True -- cgit v1.2.3