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-unixfs
Commits
6389bfda
Commit
6389bfda
authored
Dec 16, 2014
by
Jeromy
Committed by
Juan Batiz-Benet
Dec 17, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some cleanup before CR
parent
2240272d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
20 deletions
+18
-20
Godeps/Godeps.json
Godeps/Godeps.json
+1
-1
exchange/bitswap/bitswap.go
exchange/bitswap/bitswap.go
+4
-7
exchange/bitswap/strategy/interface.go
exchange/bitswap/strategy/interface.go
+0
-12
exchange/bitswap/wantlist/wantlist.go
exchange/bitswap/wantlist/wantlist.go
+13
-0
No files found.
Godeps/Godeps.json
View file @
6389bfda
{
"ImportPath"
:
"github.com/jbenet/go-ipfs"
,
"GoVersion"
:
"
devel +ffe33f1f1f17 Tue Nov 25 15:41:33 2014 +1100
"
,
"GoVersion"
:
"
go1.3
"
,
"Packages"
:
[
"./..."
],
...
...
exchange/bitswap/bitswap.go
View file @
6389bfda
...
...
@@ -32,10 +32,6 @@ var providerRequestTimeout = time.Second * 10
var
hasBlockTimeout
=
time
.
Second
*
15
var
rebroadcastDelay
=
time
.
Second
*
10
const
roundTime
=
time
.
Second
/
2
var
bandwidthPerRound
=
500000
// New initializes a BitSwap instance that communicates over the
// provided BitSwapNetwork. This function registers the returned instance as
// the network delegate.
...
...
@@ -64,7 +60,7 @@ func New(parent context.Context, p peer.Peer, network bsnet.BitSwapNetwork, rout
}
network
.
SetDelegate
(
bs
)
go
bs
.
clientWorker
(
ctx
)
go
bs
.
round
Worker
(
ctx
)
go
bs
.
task
Worker
(
ctx
)
return
bs
}
...
...
@@ -90,7 +86,8 @@ type bitswap struct {
batchRequests
chan
[]
u
.
Key
// strategy makes decisions about how to interact with partners.
strategy
strategy
.
Strategy
// TODO: strategy commented out until we have a use for it again
//strategy strategy.Strategy
ledgermanager
*
strategy
.
LedgerManager
...
...
@@ -234,7 +231,7 @@ func (bs *bitswap) sendWantlistToProviders(ctx context.Context, wantlist *wl.Wan
wg
.
Wait
()
}
func
(
bs
*
bitswap
)
round
Worker
(
ctx
context
.
Context
)
{
func
(
bs
*
bitswap
)
task
Worker
(
ctx
context
.
Context
)
{
for
{
select
{
case
<-
ctx
.
Done
()
:
...
...
exchange/bitswap/strategy/interface.go
deleted
100644 → 0
View file @
2240272d
package
strategy
import
(
bstore
"github.com/jbenet/go-ipfs/blocks/blockstore"
)
type
Strategy
interface
{
// Seed initializes the decider to a deterministic state
Seed
(
int64
)
GetTasks
(
bandwidth
int
,
ledgers
*
LedgerManager
,
bs
bstore
.
Blockstore
)
([]
*
Task
,
error
)
}
exchange/bitswap/wantlist/wantlist.go
View file @
6389bfda
...
...
@@ -56,6 +56,19 @@ func (es entrySlice) Less(i, j int) bool { return es[i].Priority > es[j].Priorit
func
(
w
*
Wantlist
)
Entries
()
[]
*
Entry
{
w
.
lk
.
RLock
()
defer
w
.
lk
.
RUnlock
()
var
es
entrySlice
for
_
,
e
:=
range
w
.
set
{
es
=
append
(
es
,
e
)
}
sort
.
Sort
(
es
)
return
es
}
func
(
w
*
Wantlist
)
SortedEntries
()
[]
*
Entry
{
w
.
lk
.
RLock
()
defer
w
.
lk
.
RUnlock
()
var
es
entrySlice
for
_
,
e
:=
range
w
.
set
{
...
...
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