diff options
author | Sam T <pxqr.sta@gmail.com> | 2013-07-07 04:54:06 +0400 |
---|---|---|
committer | Sam T <pxqr.sta@gmail.com> | 2013-07-07 04:54:06 +0400 |
commit | e424e1096f084ae59e67d02f8c0ee50d8496fbda (patch) | |
tree | 9f1b6dc98c0edb5f6814002a1ebe550a18215bee /src/Network | |
parent | 16686bf2c41f292e2647779c395ea989d2776d76 (diff) |
~ Minor changes.
Diffstat (limited to 'src/Network')
-rw-r--r-- | src/Network/BitTorrent/Internal.lhs | 71 |
1 files changed, 36 insertions, 35 deletions
diff --git a/src/Network/BitTorrent/Internal.lhs b/src/Network/BitTorrent/Internal.lhs index 08e10e71..ed4fd1a0 100644 --- a/src/Network/BitTorrent/Internal.lhs +++ b/src/Network/BitTorrent/Internal.lhs | |||
@@ -10,50 +10,54 @@ | |||
10 | > -- Network.BitTorrent.Exchange and modules. To hide some internals | 10 | > -- Network.BitTorrent.Exchange and modules. To hide some internals |
11 | > -- of this module we detach it from Exchange. | 11 | > -- of this module we detach it from Exchange. |
12 | > -- | 12 | > -- |
13 | > -- | 13 | > |
14 | > -- NOTE: expose only static data in data field lists, all dynamic | 14 | |
15 | > -- data should be modified through standalone functions. | 15 | **NOTE**: Expose only static data in data field lists, all dynamic |
16 | > -- | 16 | data should be modified through standalone functions. |
17 | |||
18 | > | ||
17 | > {-# LANGUAGE OverloadedStrings #-} | 19 | > {-# LANGUAGE OverloadedStrings #-} |
18 | > {-# LANGUAGE RecordWildCards #-} | 20 | > {-# LANGUAGE RecordWildCards #-} |
19 | > {-# LANGUAGE ViewPatterns #-} | 21 | > {-# LANGUAGE ViewPatterns #-} |
20 | > {-# LANGUAGE TemplateHaskell #-} | 22 | > {-# LANGUAGE TemplateHaskell #-} |
21 | > {-# LANGUAGE DeriveDataTypeable #-} | 23 | > {-# LANGUAGE DeriveDataTypeable #-} |
24 | > | ||
22 | > module Network.BitTorrent.Internal | 25 | > module Network.BitTorrent.Internal |
23 | > ( Progress(..), startProgress | 26 | > ( -- * Progress |
27 | > Progress(..), startProgress | ||
28 | > | ||
24 | > -- * Client | 29 | > -- * Client |
25 | > , ClientSession (clientPeerId, allowedExtensions, listenerPort) | 30 | > , ClientSession (clientPeerId, allowedExtensions, listenerPort) |
26 | > | 31 | > |
27 | > , ThreadCount | 32 | > , ThreadCount |
28 | > , defaultThreadCount | 33 | > , defaultThreadCount |
29 | > | 34 | > |
30 | > , TorrentLoc(..) | 35 | > , TorrentLoc(..) |
31 | > , registerTorrent | 36 | > , registerTorrent |
32 | > , unregisterTorrent | 37 | > , unregisterTorrent |
38 | > | ||
33 | > , newClient | 39 | > , newClient |
34 | 40 | > | |
35 | > , getCurrentProgress | 41 | > , getCurrentProgress |
36 | > , getSwarmCount | 42 | > , getSwarmCount |
37 | > , getPeerCount | 43 | > , getPeerCount |
38 | 44 | > | |
39 | |||
40 | |||
41 | > -- * Swarm | 45 | > -- * Swarm |
42 | > , SwarmSession( SwarmSession, torrentMeta, clientSession ) | 46 | > , SwarmSession( SwarmSession, torrentMeta, clientSession ) |
43 | 47 | > | |
44 | > , SessionCount | 48 | > , SessionCount |
45 | > , getSessionCount | 49 | > , getSessionCount |
46 | 50 | > | |
47 | > , newLeecher | 51 | > , newLeecher |
48 | > , newSeeder | 52 | > , newSeeder |
49 | > , getClientBitfield | 53 | > , getClientBitfield |
50 | 54 | > | |
51 | > , enterSwarm | 55 | > , enterSwarm |
52 | > , leaveSwarm | 56 | > , leaveSwarm |
53 | > , waitVacancy | 57 | > , waitVacancy |
54 | 58 | > | |
55 | > , pieceLength | 59 | > , pieceLength |
56 | 60 | > | |
57 | > -- * Peer | 61 | > -- * Peer |
58 | > , PeerSession( PeerSession, connectedPeerAddr | 62 | > , PeerSession( PeerSession, connectedPeerAddr |
59 | > , swarmSession, enabledExtensions | 63 | > , swarmSession, enabledExtensions |
@@ -61,20 +65,20 @@ | |||
61 | > ) | 65 | > ) |
62 | > , SessionState | 66 | > , SessionState |
63 | > , withPeerSession | 67 | > , withPeerSession |
64 | 68 | > | |
65 | > -- ** Broadcasting | 69 | > -- ** Broadcasting |
66 | > , available | 70 | > , available |
67 | > , getPending | 71 | > , getPending |
68 | 72 | > | |
69 | > -- ** Exceptions | 73 | > -- ** Exceptions |
70 | > , SessionException(..) | 74 | > , SessionException(..) |
71 | > , isSessionException | 75 | > , isSessionException |
72 | > , putSessionException | 76 | > , putSessionException |
73 | 77 | > | |
74 | > -- ** Properties | 78 | > -- ** Properties |
75 | > , bitfield, status | 79 | > , bitfield, status |
76 | > , findPieceCount | 80 | > , findPieceCount |
77 | 81 | > | |
78 | > -- * Timeouts | 82 | > -- * Timeouts |
79 | > , updateIncoming, updateOutcoming | 83 | > , updateIncoming, updateOutcoming |
80 | > ) where | 84 | > ) where |
@@ -117,14 +121,12 @@ | |||
117 | Progress | 121 | Progress |
118 | ------------------------------------------------------------------------ | 122 | ------------------------------------------------------------------------ |
119 | 123 | ||
124 | Progress data is considered as dynamic within one client session. This | ||
125 | data also should be shared across client application sessions | ||
126 | (e.g. files), otherwise use 'startProgress' to get initial 'Progress'. | ||
127 | |||
120 | > -- | 'Progress' contains upload/download/left stats about | 128 | > -- | 'Progress' contains upload/download/left stats about |
121 | > -- current client state and used to notify the tracker. | 129 | > -- current client state and used to notify the tracker. |
122 | > -- | ||
123 | > -- This data is considered as dynamic within one client | ||
124 | > -- session. This data also should be shared across client | ||
125 | > -- application sessions (e.g. files), otherwise use 'startProgress' | ||
126 | > -- to get initial 'Progress'. | ||
127 | > -- | ||
128 | > data Progress = Progress { | 130 | > data Progress = Progress { |
129 | > _uploaded :: !Integer -- ^ Total amount of bytes uploaded. | 131 | > _uploaded :: !Integer -- ^ Total amount of bytes uploaded. |
130 | > , _downloaded :: !Integer -- ^ Total amount of bytes downloaded. | 132 | > , _downloaded :: !Integer -- ^ Total amount of bytes downloaded. |
@@ -378,17 +380,16 @@ and different enabled extensions at the same time. | |||
378 | Swarm session | 380 | Swarm session |
379 | ------------------------------------------------------------------------ | 381 | ------------------------------------------------------------------------ |
380 | 382 | ||
381 | > {- NOTE: If client is a leecher then there is NO particular reason to | 383 | NOTE: If client is a leecher then there is NO particular reason to |
382 | > set max sessions count more than the_number_of_unchoke_slots * k: | 384 | set max sessions count more than the_number_of_unchoke_slots * k: |
383 | 385 | ||
384 | > * thread slot(activeThread semaphore) | 386 | * thread slot(activeThread semaphore) |
385 | > * will take but no | 387 | * will take but no |
386 | 388 | ||
387 | > So if client is a leecher then max sessions count depends on the | 389 | So if client is a leecher then max sessions count depends on the |
388 | > number of unchoke slots. | 390 | number of unchoke slots. |
389 | 391 | ||
390 | > However if client is a seeder then the value depends on . | 392 | However if client is a seeder then the value depends on . |
391 | > -} | ||
392 | 393 | ||
393 | > -- | Used to bound the number of simultaneous connections and, which | 394 | > -- | Used to bound the number of simultaneous connections and, which |
394 | > -- is the same, P2P sessions within the swarm session. | 395 | > -- is the same, P2P sessions within the swarm session. |