Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
0b42d77e
提交
0b42d77e
authored
10月 27, 2014
作者:
Brian Tiger Chow
提交者:
Juan Batiz-Benet
11月 15, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(core, bitswap) split bitswap init into two steps
@jbenet
上级
154cf4af
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
8 行增加
和
9 行删除
+8
-9
core.go
core/core.go
+3
-2
bitswap.go
exchange/bitswap/bitswap.go
+5
-7
没有找到文件。
core/core.go
浏览文件 @
0b42d77e
...
...
@@ -15,6 +15,7 @@ import (
diag
"github.com/jbenet/go-ipfs/diagnostics"
exchange
"github.com/jbenet/go-ipfs/exchange"
bitswap
"github.com/jbenet/go-ipfs/exchange/bitswap"
bsnet
"github.com/jbenet/go-ipfs/exchange/bitswap/network"
merkledag
"github.com/jbenet/go-ipfs/merkledag"
namesys
"github.com/jbenet/go-ipfs/namesys"
inet
"github.com/jbenet/go-ipfs/net"
...
...
@@ -150,8 +151,8 @@ func NewIpfsNode(cfg *config.Config, online bool) (n *IpfsNode, err error) {
// setup exchange service
const
alwaysSendToPeer
=
true
// use YesManStrategy
n
.
Exchange
=
bitswap
.
NetMessageSession
(
ctx
,
n
.
Identity
,
n
.
Network
,
exchangeService
,
n
.
Routing
,
n
.
Datastore
,
alwaysSendToPeer
)
// ok, this function call is ridiculous o/ consider making it simpler.
bitswapNetwork
:=
bsnet
.
NewFromIpfsNetwork
(
exchangeService
,
n
.
Network
)
n
.
Exchange
=
bitswap
.
New
(
ctx
,
n
.
Identity
,
bitswapNetwork
,
n
.
Routing
,
n
.
Datastore
,
alwaysSendToPeer
)
go
initConnections
(
ctx
,
n
.
Config
,
n
.
Peerstore
,
dhtRouting
)
}
...
...
exchange/bitswap/bitswap.go
浏览文件 @
0b42d77e
...
...
@@ -15,18 +15,18 @@ import (
bsnet
"github.com/jbenet/go-ipfs/exchange/bitswap/network"
notifications
"github.com/jbenet/go-ipfs/exchange/bitswap/notifications"
strategy
"github.com/jbenet/go-ipfs/exchange/bitswap/strategy"
inet
"github.com/jbenet/go-ipfs/net"
peer
"github.com/jbenet/go-ipfs/peer"
u
"github.com/jbenet/go-ipfs/util"
)
var
log
=
u
.
Logger
(
"bitswap"
)
// NetMessageSession initializes a BitSwap session that communicates over the
// provided NetMessage service.
// New initializes a BitSwap instance that communicates over the
// provided BitSwapNetwork. This function registers the returned instance as
// the network delegate.
// Runs until context is cancelled
func
Ne
tMessageSession
(
ctx
context
.
Context
,
p
peer
.
Peer
,
net
inet
.
Network
,
srv
inet
.
Service
,
routing
bsnet
.
Routing
,
func
Ne
w
(
ctx
context
.
Context
,
p
peer
.
Peer
,
net
work
bsnet
.
BitSwapNetwork
,
routing
bsnet
.
Routing
,
d
ds
.
ThreadSafeDatastore
,
nice
bool
)
exchange
.
Interface
{
notif
:=
notifications
.
New
()
...
...
@@ -37,8 +37,6 @@ func NetMessageSession(ctx context.Context, p peer.Peer,
}
}()
network
:=
bsnet
.
NewFromIpfsNetwork
(
srv
,
net
)
bs
:=
&
bitswap
{
blockstore
:
blockstore
.
NewBlockstore
(
d
),
notifications
:
notif
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论