@cryptotaxi247 / kubo / commits / 3178dfe78

add more bitswap task workers

Jeromy committed Apr 17, 2015 at 12:43 UTC 3178dfe78b3cc1cf1fd461f2e47a61a6ad3389d6
1 file changed +8 -4
exchange/bitswap/workers.go
+8 -4
@@ -9,16 +9,20 @@ import (
9 u "github.com/ipfs/go-ipfs/util"
10 )
11
12 +var TaskWorkerCount = 4
13 +
14 func (bs *Bitswap) startWorkers(px process.Process, ctx context.Context) {
15 // Start up a worker to handle block requests this node is making
16 px.Go(func(px process.Process) {
17 bs.clientWorker(ctx)
18 })
19
18 - // Start up a worker to handle requests from other nodes for the data on this node
19 - px.Go(func(px process.Process) {
20 - bs.taskWorker(ctx)
21 - })
20 + // Start up workers to handle requests from other nodes for the data on this node
21 + for i := 0; i < TaskWorkerCount; i++ {
22 + px.Go(func(px process.Process) {
23 + bs.taskWorker(ctx)
24 + })
25 + }
26
27 // Start up a worker to manage periodically resending our wantlist out to peers
28 px.Go(func(px process.Process) {