diff options
author | joe <joe@jerkface.net> | 2015-03-29 01:06:34 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2015-03-29 01:06:34 -0400 |
commit | c88a76cb1c6ee7e54628b78a56f1a25415a39c30 (patch) | |
tree | 567ee2accc815e3f2a71c8f8434eefef82e60ef7 /src/Network/BitTorrent/Exchange/Session.hs | |
parent | e569586521be76e0f02137e01af9375d327d461c (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.hs | 20 |
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 #-} | ||
5 | module Network.BitTorrent.Exchange.Session | 7 | module Network.BitTorrent.Exchange.Session |
6 | ( -- * Session | 8 | ( -- * Session |
7 | Session | 9 | Session |
@@ -43,7 +45,7 @@ import Data.Set as S | |||
43 | import Data.Text as T | 45 | import Data.Text as T |
44 | import Data.Typeable | 46 | import Data.Typeable |
45 | import Text.PrettyPrint hiding ((<>)) | 47 | import Text.PrettyPrint hiding ((<>)) |
46 | import Text.PrettyPrint.Class | 48 | import Text.PrettyPrint.HughesPJClass hiding ((<>),($$)) |
47 | import System.Log.FastLogger (LogStr, ToLogStr (..)) | 49 | import System.Log.FastLogger (LogStr, ToLogStr (..)) |
48 | 50 | ||
49 | import Data.BEncode as BE | 51 | import Data.BEncode as BE |
@@ -57,6 +59,10 @@ import Network.BitTorrent.Exchange.Download as D | |||
57 | import Network.BitTorrent.Exchange.Message as Message | 59 | import Network.BitTorrent.Exchange.Message as Message |
58 | import System.Torrent.Storage | 60 | import System.Torrent.Storage |
59 | 61 | ||
62 | #if !MIN_VERSION_iproute(1,2,12) | ||
63 | deriving 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 | ||
228 | logMessage :: MonadLogger m => Message -> m () | 234 | logMessage :: MonadLogger m => Message -> m () |
229 | logMessage msg = logDebugN $ T.pack (render (pretty msg)) | 235 | logMessage msg = logDebugN $ T.pack (render (pPrint msg)) |
230 | 236 | ||
231 | logEvent :: MonadLogger m => Text -> m () | 237 | logEvent :: MonadLogger m => Text -> m () |
232 | logEvent = logInfoN | 238 | logEvent = logInfoN |