Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
4bcfe094
Commit
4bcfe094
authored
Dec 17, 2014
by
Brian Tiger Chow
Committed by
Juan Batiz-Benet
Dec 17, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extract constants
License: MIT Signed-off-by:
Brian Tiger Chow
<
brian@perfmode.com
>
parent
0545c4d1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
exchange/bitswap/bitswap.go
exchange/bitswap/bitswap.go
+2
-1
exchange/bitswap/decision/engine.go
exchange/bitswap/decision/engine.go
+5
-1
No files found.
exchange/bitswap/bitswap.go
View file @
4bcfe094
...
@@ -29,6 +29,7 @@ const (
...
@@ -29,6 +29,7 @@ const (
maxProvidersPerRequest
=
3
maxProvidersPerRequest
=
3
providerRequestTimeout
=
time
.
Second
*
10
providerRequestTimeout
=
time
.
Second
*
10
hasBlockTimeout
=
time
.
Second
*
15
hasBlockTimeout
=
time
.
Second
*
15
sizeBatchRequestChan
=
32
)
)
var
(
var
(
...
@@ -59,7 +60,7 @@ func New(parent context.Context, p peer.Peer, network bsnet.BitSwapNetwork, rout
...
@@ -59,7 +60,7 @@ func New(parent context.Context, p peer.Peer, network bsnet.BitSwapNetwork, rout
routing
:
routing
,
routing
:
routing
,
sender
:
network
,
sender
:
network
,
wantlist
:
wantlist
.
NewThreadSafe
(),
wantlist
:
wantlist
.
NewThreadSafe
(),
batchRequests
:
make
(
chan
[]
u
.
Key
,
32
),
batchRequests
:
make
(
chan
[]
u
.
Key
,
sizeBatchRequestChan
),
}
}
network
.
SetDelegate
(
bs
)
network
.
SetDelegate
(
bs
)
go
bs
.
clientWorker
(
ctx
)
go
bs
.
clientWorker
(
ctx
)
...
...
exchange/bitswap/decision/engine.go
View file @
4bcfe094
...
@@ -13,6 +13,10 @@ import (
...
@@ -13,6 +13,10 @@ import (
var
log
=
u
.
Logger
(
"engine"
)
var
log
=
u
.
Logger
(
"engine"
)
const
(
sizeOutboxChan
=
4
)
// Envelope contains a message for a Peer
// Envelope contains a message for a Peer
type
Envelope
struct
{
type
Envelope
struct
{
// Peer is the intended recipient
// Peer is the intended recipient
...
@@ -43,7 +47,7 @@ func NewEngine(ctx context.Context, bs bstore.Blockstore) *Engine {
...
@@ -43,7 +47,7 @@ func NewEngine(ctx context.Context, bs bstore.Blockstore) *Engine {
ledgerMap
:
make
(
map
[
u
.
Key
]
*
ledger
),
ledgerMap
:
make
(
map
[
u
.
Key
]
*
ledger
),
bs
:
bs
,
bs
:
bs
,
peerRequestQueue
:
newTaskQueue
(),
peerRequestQueue
:
newTaskQueue
(),
outbox
:
make
(
chan
Envelope
,
4
),
// TODO extract constant
outbox
:
make
(
chan
Envelope
,
sizeOutboxChan
),
workSignal
:
make
(
chan
struct
{}),
workSignal
:
make
(
chan
struct
{}),
}
}
go
e
.
taskWorker
(
ctx
)
go
e
.
taskWorker
(
ctx
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment