diff options
Diffstat (limited to 'src/Network/BitTorrent/Exchange/Connection.hs')
-rw-r--r-- | src/Network/BitTorrent/Exchange/Connection.hs | 32 |
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 | |||
131 | import Network.Socket hiding (Connected) | 131 | import Network.Socket hiding (Connected) |
132 | import Network.Socket.ByteString as BS | 132 | import Network.Socket.ByteString as BS |
133 | import Text.PrettyPrint as PP hiding ((<>)) | 133 | import Text.PrettyPrint as PP hiding ((<>)) |
134 | import Text.PrettyPrint.Class | 134 | import Text.PrettyPrint.HughesPJClass hiding ((<>),($$)) |
135 | import Text.Show.Functions () | 135 | import Text.Show.Functions () |
136 | import System.Log.FastLogger (ToLogStr(..)) | 136 | import System.Log.FastLogger (ToLogStr(..)) |
137 | import System.Timeout | 137 | import System.Timeout |
@@ -161,7 +161,7 @@ instance Default ChannelSide where | |||
161 | def = ThisPeer | 161 | def = ThisPeer |
162 | 162 | ||
163 | instance Pretty ChannelSide where | 163 | instance 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 | ||
215 | instance Pretty ProtocolError where | 215 | instance Pretty ProtocolError where |
216 | pretty = PP.text . show | 216 | pPrint = PP.text . show |
217 | 217 | ||
218 | errorPenalty :: ProtocolError -> Int | 218 | errorPenalty :: ProtocolError -> Int |
219 | errorPenalty (InvalidProtocol _) = 1 | 219 | errorPenalty (InvalidProtocol _) = 1 |
@@ -256,7 +256,7 @@ data WireFailure | |||
256 | instance Exception WireFailure | 256 | instance Exception WireFailure |
257 | 257 | ||
258 | instance Pretty WireFailure where | 258 | instance 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 | ||
290 | instance Pretty FlowStats where | 290 | instance 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. |
296 | instance Default FlowStats where | 296 | instance Default FlowStats where |
@@ -328,10 +328,10 @@ data ConnectionStats = ConnectionStats | |||
328 | } deriving Show | 328 | } deriving Show |
329 | 329 | ||
330 | instance Pretty ConnectionStats where | 330 | instance 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 | ||
495 | instance Pretty PeerStatus where | 495 | instance 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. |
500 | instance Default PeerStatus where | 500 | instance Default PeerStatus where |
@@ -535,9 +535,9 @@ data ConnectionStatus = ConnectionStatus | |||
535 | $(makeLenses ''ConnectionStatus) | 535 | $(makeLenses ''ConnectionStatus) |
536 | 536 | ||
537 | instance Pretty ConnectionStatus where | 537 | instance 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. |
543 | instance Default ConnectionStatus where | 543 | instance Default ConnectionStatus where |
@@ -646,7 +646,7 @@ data Connection s = Connection | |||
646 | } | 646 | } |
647 | 647 | ||
648 | instance Pretty (Connection s) where | 648 | instance Pretty (Connection s) where |
649 | pretty Connection {..} = "Connection" | 649 | pPrint Connection {..} = "Connection" |
650 | 650 | ||
651 | instance ToLogStr (Connection s) where | 651 | instance ToLogStr (Connection s) where |
652 | toLogStr Connection {..} = mconcat | 652 | toLogStr Connection {..} = mconcat |