diff options
author | Sam T <pxqr.sta@gmail.com> | 2013-06-13 07:36:48 +0400 |
---|---|---|
committer | Sam T <pxqr.sta@gmail.com> | 2013-06-13 07:36:48 +0400 |
commit | 38d8eb046cefce18a6689488994c05abf1223ffe (patch) | |
tree | a222a85d637759befe1f88ba0c775cc6f8a56181 /src/Network/BitTorrent/Internal.hs | |
parent | 9557004a2c916d475038f99cf26e5c36bbbae0a4 (diff) |
+ Add defaultClient function.
This exposes problems with keepalives:
exsample: sendWakeup: resource exhausted (Resource temporarily
unavailable )
Diffstat (limited to 'src/Network/BitTorrent/Internal.hs')
-rw-r--r-- | src/Network/BitTorrent/Internal.hs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/Network/BitTorrent/Internal.hs b/src/Network/BitTorrent/Internal.hs index 2fadd9ce..afe1fff1 100644 --- a/src/Network/BitTorrent/Internal.hs +++ b/src/Network/BitTorrent/Internal.hs | |||
@@ -28,6 +28,8 @@ module Network.BitTorrent.Internal | |||
28 | , ClientSession (clientPeerID, allowedExtensions) | 28 | , ClientSession (clientPeerID, allowedExtensions) |
29 | , newClient, getCurrentProgress | 29 | , newClient, getCurrentProgress |
30 | 30 | ||
31 | , ThreadCount, defaultThreadCount | ||
32 | |||
31 | -- * Swarm | 33 | -- * Swarm |
32 | , SwarmSession(SwarmSession, torrentMeta, clientSession) | 34 | , SwarmSession(SwarmSession, torrentMeta, clientSession) |
33 | , newLeacher, newSeeder | 35 | , newLeacher, newSeeder |
@@ -109,6 +111,9 @@ startProgress = Progress 0 0 | |||
109 | 111 | ||
110 | type ThreadCount = Int | 112 | type ThreadCount = Int |
111 | 113 | ||
114 | defaultThreadCount :: ThreadCount | ||
115 | defaultThreadCount = 1000 | ||
116 | |||
112 | -- | In one application we could have many clients with difference | 117 | -- | In one application we could have many clients with difference |
113 | -- ID's and different enabled extensions. | 118 | -- ID's and different enabled extensions. |
114 | data ClientSession = ClientSession { | 119 | data ClientSession = ClientSession { |
@@ -166,6 +171,13 @@ newClient n exts = do | |||
166 | 171 | ||
167 | type SessionCount = Int | 172 | type SessionCount = Int |
168 | 173 | ||
174 | defSeederConns :: SessionCount | ||
175 | defSeederConns = defaultUnchokeSlots | ||
176 | |||
177 | defLeacherConns :: SessionCount | ||
178 | defLeacherConns = defaultNumWant | ||
179 | |||
180 | |||
169 | -- | Extensions are set globally by | 181 | -- | Extensions are set globally by |
170 | -- Swarm session are un | 182 | -- Swarm session are un |
171 | data SwarmSession = SwarmSession { | 183 | data SwarmSession = SwarmSession { |
@@ -204,12 +216,6 @@ newLeacher :: ClientSession -> Torrent -> IO SwarmSession | |||
204 | newLeacher cs t @ Torrent {..} | 216 | newLeacher cs t @ Torrent {..} |
205 | = newSwarmSession defLeacherConns (haveNone (pieceCount tInfo)) cs t | 217 | = newSwarmSession defLeacherConns (haveNone (pieceCount tInfo)) cs t |
206 | 218 | ||
207 | defSeederConns :: SessionCount | ||
208 | defSeederConns = defaultUnchokeSlots | ||
209 | |||
210 | defLeacherConns :: SessionCount | ||
211 | defLeacherConns = defaultNumWant | ||
212 | |||
213 | --isLeacher :: SwarmSession -> IO Bool | 219 | --isLeacher :: SwarmSession -> IO Bool |
214 | --isLeacher = undefined | 220 | --isLeacher = undefined |
215 | 221 | ||