summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Exchange/Session.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2015-03-29 01:06:34 -0400
committerjoe <joe@jerkface.net>2015-03-29 01:06:34 -0400
commitc88a76cb1c6ee7e54628b78a56f1a25415a39c30 (patch)
tree567ee2accc815e3f2a71c8f8434eefef82e60ef7 /src/Network/BitTorrent/Exchange/Session.hs
parente569586521be76e0f02137e01af9375d327d461c (diff)
Updates to build against newer libraries:
* prettyclass instead of deprecated pretty-class * use pPrint instead of pretty * backported to iproute-1.2.11 (convenient for debian jessie)
Diffstat (limited to 'src/Network/BitTorrent/Exchange/Session.hs')
-rw-r--r--src/Network/BitTorrent/Exchange/Session.hs20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/Network/BitTorrent/Exchange/Session.hs b/src/Network/BitTorrent/Exchange/Session.hs
index 2bd275bd..ca849c23 100644
--- a/src/Network/BitTorrent/Exchange/Session.hs
+++ b/src/Network/BitTorrent/Exchange/Session.hs
@@ -1,7 +1,9 @@
1{-# LANGUAGE FlexibleInstances #-} 1{-# LANGUAGE CPP #-}
2{-# LANGUAGE TypeFamilies #-} 2{-# LANGUAGE DeriveDataTypeable #-}
3{-# LANGUAGE TemplateHaskell #-} 3{-# LANGUAGE FlexibleInstances #-}
4{-# LANGUAGE DeriveDataTypeable #-} 4{-# LANGUAGE StandaloneDeriving #-}
5{-# LANGUAGE TemplateHaskell #-}
6{-# LANGUAGE TypeFamilies #-}
5module Network.BitTorrent.Exchange.Session 7module Network.BitTorrent.Exchange.Session
6 ( -- * Session 8 ( -- * Session
7 Session 9 Session
@@ -43,7 +45,7 @@ import Data.Set as S
43import Data.Text as T 45import Data.Text as T
44import Data.Typeable 46import Data.Typeable
45import Text.PrettyPrint hiding ((<>)) 47import Text.PrettyPrint hiding ((<>))
46import Text.PrettyPrint.Class 48import Text.PrettyPrint.HughesPJClass hiding ((<>),($$))
47import System.Log.FastLogger (LogStr, ToLogStr (..)) 49import System.Log.FastLogger (LogStr, ToLogStr (..))
48 50
49import Data.BEncode as BE 51import Data.BEncode as BE
@@ -57,6 +59,10 @@ import Network.BitTorrent.Exchange.Download as D
57import Network.BitTorrent.Exchange.Message as Message 59import Network.BitTorrent.Exchange.Message as Message
58import System.Torrent.Storage 60import System.Torrent.Storage
59 61
62#if !MIN_VERSION_iproute(1,2,12)
63deriving instance Ord IP
64#endif
65
60{----------------------------------------------------------------------- 66{-----------------------------------------------------------------------
61-- Exceptions 67-- Exceptions
62-----------------------------------------------------------------------} 68-----------------------------------------------------------------------}
@@ -222,11 +228,11 @@ instance MonadLogger (Connected Session) where
222 conn <- ask 228 conn <- ask
223 ses <- asks connSession 229 ses <- asks connSession
224 addr <- asks connRemoteAddr 230 addr <- asks connRemoteAddr
225 let addrSrc = src <> " @ " <> T.pack (render (pretty addr)) 231 let addrSrc = src <> " @ " <> T.pack (render (pPrint addr))
226 liftIO $ sessionLogger ses loc addrSrc lvl (toLogStr msg) 232 liftIO $ sessionLogger ses loc addrSrc lvl (toLogStr msg)
227 233
228logMessage :: MonadLogger m => Message -> m () 234logMessage :: MonadLogger m => Message -> m ()
229logMessage msg = logDebugN $ T.pack (render (pretty msg)) 235logMessage msg = logDebugN $ T.pack (render (pPrint msg))
230 236
231logEvent :: MonadLogger m => Text -> m () 237logEvent :: MonadLogger m => Text -> m ()
232logEvent = logInfoN 238logEvent = logInfoN