summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Exchange/Connection.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/Connection.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/Connection.hs')
-rw-r--r--src/Network/BitTorrent/Exchange/Connection.hs32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/Network/BitTorrent/Exchange/Connection.hs b/src/Network/BitTorrent/Exchange/Connection.hs
index 2d5f39bf..d65d322e 100644
--- a/src/Network/BitTorrent/Exchange/Connection.hs
+++ b/src/Network/BitTorrent/Exchange/Connection.hs
@@ -131,7 +131,7 @@ import Network
131import Network.Socket hiding (Connected) 131import Network.Socket hiding (Connected)
132import Network.Socket.ByteString as BS 132import Network.Socket.ByteString as BS
133import Text.PrettyPrint as PP hiding ((<>)) 133import Text.PrettyPrint as PP hiding ((<>))
134import Text.PrettyPrint.Class 134import Text.PrettyPrint.HughesPJClass hiding ((<>),($$))
135import Text.Show.Functions () 135import Text.Show.Functions ()
136import System.Log.FastLogger (ToLogStr(..)) 136import System.Log.FastLogger (ToLogStr(..))
137import System.Timeout 137import System.Timeout
@@ -161,7 +161,7 @@ instance Default ChannelSide where
161 def = ThisPeer 161 def = ThisPeer
162 162
163instance Pretty ChannelSide where 163instance Pretty ChannelSide where
164 pretty = PP.text . show 164 pPrint = PP.text . show
165 165
166-- | A protocol errors occur when a peer violates protocol 166-- | A protocol errors occur when a peer violates protocol
167-- specification. 167-- specification.
@@ -213,7 +213,7 @@ data ProtocolError
213 deriving Show 213 deriving Show
214 214
215instance Pretty ProtocolError where 215instance Pretty ProtocolError where
216 pretty = PP.text . show 216 pPrint = PP.text . show
217 217
218errorPenalty :: ProtocolError -> Int 218errorPenalty :: ProtocolError -> Int
219errorPenalty (InvalidProtocol _) = 1 219errorPenalty (InvalidProtocol _) = 1
@@ -256,7 +256,7 @@ data WireFailure
256instance Exception WireFailure 256instance Exception WireFailure
257 257
258instance Pretty WireFailure where 258instance Pretty WireFailure where
259 pretty = PP.text . show 259 pPrint = PP.text . show
260 260
261-- TODO 261-- TODO
262-- data Penalty = Ban | Penalty Int 262-- data Penalty = Ban | Penalty Int
@@ -288,9 +288,9 @@ data FlowStats = FlowStats
288 } deriving Show 288 } deriving Show
289 289
290instance Pretty FlowStats where 290instance Pretty FlowStats where
291 pretty FlowStats {..} = 291 pPrint FlowStats {..} =
292 PP.int messageCount <+> "messages" $+$ 292 PP.int messageCount <+> "messages" $+$
293 pretty messageBytes 293 pPrint messageBytes
294 294
295-- | Zeroed stats. 295-- | Zeroed stats.
296instance Default FlowStats where 296instance Default FlowStats where
@@ -328,10 +328,10 @@ data ConnectionStats = ConnectionStats
328 } deriving Show 328 } deriving Show
329 329
330instance Pretty ConnectionStats where 330instance Pretty ConnectionStats where
331 pretty ConnectionStats {..} = vcat 331 pPrint ConnectionStats {..} = vcat
332 [ "Recv:" <+> pretty incomingFlow 332 [ "Recv:" <+> pPrint incomingFlow
333 , "Sent:" <+> pretty outcomingFlow 333 , "Sent:" <+> pPrint outcomingFlow
334 , "Both:" <+> pretty (incomingFlow <> outcomingFlow) 334 , "Both:" <+> pPrint (incomingFlow <> outcomingFlow)
335 ] 335 ]
336 336
337-- | Zeroed stats. 337-- | Zeroed stats.
@@ -493,8 +493,8 @@ data PeerStatus = PeerStatus
493$(makeLenses ''PeerStatus) 493$(makeLenses ''PeerStatus)
494 494
495instance Pretty PeerStatus where 495instance Pretty PeerStatus where
496 pretty PeerStatus {..} = 496 pPrint PeerStatus {..} =
497 pretty (Choking _choking) <+> "and" <+> pretty (Interested _interested) 497 pPrint (Choking _choking) <+> "and" <+> pPrint (Interested _interested)
498 498
499-- | Connections start out choked and not interested. 499-- | Connections start out choked and not interested.
500instance Default PeerStatus where 500instance Default PeerStatus where
@@ -535,9 +535,9 @@ data ConnectionStatus = ConnectionStatus
535$(makeLenses ''ConnectionStatus) 535$(makeLenses ''ConnectionStatus)
536 536
537instance Pretty ConnectionStatus where 537instance Pretty ConnectionStatus where
538 pretty ConnectionStatus {..} = 538 pPrint ConnectionStatus {..} =
539 "this " PP.<+> pretty _clientStatus PP.$$ 539 "this " PP.<+> pPrint _clientStatus PP.$$
540 "remote" PP.<+> pretty _remoteStatus 540 "remote" PP.<+> pPrint _remoteStatus
541 541
542-- | Connections start out choked and not interested. 542-- | Connections start out choked and not interested.
543instance Default ConnectionStatus where 543instance Default ConnectionStatus where
@@ -646,7 +646,7 @@ data Connection s = Connection
646 } 646 }
647 647
648instance Pretty (Connection s) where 648instance Pretty (Connection s) where
649 pretty Connection {..} = "Connection" 649 pPrint Connection {..} = "Connection"
650 650
651instance ToLogStr (Connection s) where 651instance ToLogStr (Connection s) where
652 toLogStr Connection {..} = mconcat 652 toLogStr Connection {..} = mconcat