diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-12 19:51:00 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-12 19:51:00 +0400 |
commit | 538d67c8c29b5ba30a81ec4c516598d38352eaf0 (patch) | |
tree | e0a9270e3da807eca75eb4acaecf5093d3f4197c /src/Network | |
parent | 920dd0a8eb40ec65f794fd6480835a14066d8a99 (diff) |
Rename SessionStatus to ConnectionStatus
Diffstat (limited to 'src/Network')
-rw-r--r-- | src/Network/BitTorrent/Exchange/Status.hs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/Network/BitTorrent/Exchange/Status.hs b/src/Network/BitTorrent/Exchange/Status.hs index 8472e575..bc7840a3 100644 --- a/src/Network/BitTorrent/Exchange/Status.hs +++ b/src/Network/BitTorrent/Exchange/Status.hs | |||
@@ -19,8 +19,8 @@ module Network.BitTorrent.Exchange.Status | |||
19 | , updateStatus | 19 | , updateStatus |
20 | , statusUpdates | 20 | , statusUpdates |
21 | 21 | ||
22 | -- * Session status | 22 | -- * Connection status |
23 | , SessionStatus(..) | 23 | , ConnectionStatus(..) |
24 | , clientStatus | 24 | , clientStatus |
25 | , remoteStatus | 25 | , remoteStatus |
26 | 26 | ||
@@ -94,35 +94,35 @@ statusUpdates a b = catMaybes $ | |||
94 | ] | 94 | ] |
95 | 95 | ||
96 | {----------------------------------------------------------------------- | 96 | {----------------------------------------------------------------------- |
97 | -- Session status | 97 | -- Connection status |
98 | -----------------------------------------------------------------------} | 98 | -----------------------------------------------------------------------} |
99 | 99 | ||
100 | -- | Status of the both endpoints. | 100 | -- | Status of the both endpoints. |
101 | data SessionStatus = SessionStatus | 101 | data ConnectionStatus = ConnectionStatus |
102 | { _clientStatus :: !PeerStatus | 102 | { _clientStatus :: !PeerStatus |
103 | , _remoteStatus :: !PeerStatus | 103 | , _remoteStatus :: !PeerStatus |
104 | } deriving (Show, Eq) | 104 | } deriving (Show, Eq) |
105 | 105 | ||
106 | $(makeLenses ''SessionStatus) | 106 | $(makeLenses ''ConnectionStatus) |
107 | $(deriveJSON omitRecordPrefix ''SessionStatus) | 107 | $(deriveJSON omitRecordPrefix ''ConnectionStatus) |
108 | 108 | ||
109 | instance Pretty SessionStatus where | 109 | instance Pretty ConnectionStatus where |
110 | pretty SessionStatus {..} = | 110 | pretty ConnectionStatus {..} = |
111 | "this " <+> pretty _clientStatus $$ | 111 | "this " <+> pretty _clientStatus $$ |
112 | "remote" <+> pretty _remoteStatus | 112 | "remote" <+> pretty _remoteStatus |
113 | 113 | ||
114 | -- | Connections start out choked and not interested. | 114 | -- | Connections start out choked and not interested. |
115 | instance Default SessionStatus where | 115 | instance Default ConnectionStatus where |
116 | def = SessionStatus def def | 116 | def = ConnectionStatus def def |
117 | 117 | ||
118 | -- | Can the client transfer to the remote peer? | 118 | -- | Can the client transfer to the remote peer? |
119 | canUpload :: SessionStatus -> Bool | 119 | canUpload :: ConnectionStatus -> Bool |
120 | canUpload SessionStatus {..} | 120 | canUpload ConnectionStatus {..} |
121 | = _interested _remoteStatus && not (_choking _clientStatus) | 121 | = _interested _remoteStatus && not (_choking _clientStatus) |
122 | 122 | ||
123 | -- | Can the client transfer from the remote peer? | 123 | -- | Can the client transfer from the remote peer? |
124 | canDownload :: SessionStatus -> Bool | 124 | canDownload :: ConnectionStatus -> Bool |
125 | canDownload SessionStatus {..} | 125 | canDownload ConnectionStatus {..} |
126 | = _interested _clientStatus && not (_choking _remoteStatus) | 126 | = _interested _clientStatus && not (_choking _remoteStatus) |
127 | 127 | ||
128 | -- | Indicates how many peers are allowed to download from the client | 128 | -- | Indicates how many peers are allowed to download from the client |