Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
6389bfda
提交
6389bfda
authored
12月 16, 2014
作者:
Jeromy
提交者:
Juan Batiz-Benet
12月 17, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
some cleanup before CR
上级
2240272d
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
18 行增加
和
20 行删除
+18
-20
Godeps.json
Godeps/Godeps.json
+1
-1
bitswap.go
exchange/bitswap/bitswap.go
+4
-7
interface.go
exchange/bitswap/strategy/interface.go
+0
-12
wantlist.go
exchange/bitswap/wantlist/wantlist.go
+13
-0
没有找到文件。
Godeps/Godeps.json
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论