summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Internal.hs
diff options
context:
space:
mode:
authorSam T <pxqr.sta@gmail.com>2013-06-13 07:36:48 +0400
committerSam T <pxqr.sta@gmail.com>2013-06-13 07:36:48 +0400
commit38d8eb046cefce18a6689488994c05abf1223ffe (patch)
treea222a85d637759befe1f88ba0c775cc6f8a56181 /src/Network/BitTorrent/Internal.hs
parent9557004a2c916d475038f99cf26e5c36bbbae0a4 (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.hs18
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
110type ThreadCount = Int 112type ThreadCount = Int
111 113
114defaultThreadCount :: ThreadCount
115defaultThreadCount = 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.
114data ClientSession = ClientSession { 119data ClientSession = ClientSession {
@@ -166,6 +171,13 @@ newClient n exts = do
166 171
167type SessionCount = Int 172type SessionCount = Int
168 173
174defSeederConns :: SessionCount
175defSeederConns = defaultUnchokeSlots
176
177defLeacherConns :: SessionCount
178defLeacherConns = 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
171data SwarmSession = SwarmSession { 183data SwarmSession = SwarmSession {
@@ -204,12 +216,6 @@ newLeacher :: ClientSession -> Torrent -> IO SwarmSession
204newLeacher cs t @ Torrent {..} 216newLeacher cs t @ Torrent {..}
205 = newSwarmSession defLeacherConns (haveNone (pieceCount tInfo)) cs t 217 = newSwarmSession defLeacherConns (haveNone (pieceCount tInfo)) cs t
206 218
207defSeederConns :: SessionCount
208defSeederConns = defaultUnchokeSlots
209
210defLeacherConns :: SessionCount
211defLeacherConns = defaultNumWant
212
213--isLeacher :: SwarmSession -> IO Bool 219--isLeacher :: SwarmSession -> IO Bool
214--isLeacher = undefined 220--isLeacher = undefined
215 221