Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
80c73f26
提交
80c73f26
authored
11月 04, 2015
作者:
Jeromy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add in some more notifications to help profile queries
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
上级
261cdee4
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
18 行增加
和
2 行删除
+18
-2
query.go
notifications/query.go
+2
-0
query.go
routing/dht/query.go
+16
-2
没有找到文件。
notifications/query.go
浏览文件 @
80c73f26
...
...
@@ -18,6 +18,8 @@ const (
QueryError
Provider
Value
AddingPeer
DialingPeer
)
type
QueryEvent
struct
{
...
...
routing/dht/query.go
浏览文件 @
80c73f26
...
...
@@ -79,6 +79,8 @@ type dhtQueryRunner struct {
rateLimit
chan
struct
{}
// processing semaphore
log
logging
.
EventLogger
runCtx
context
.
Context
proc
process
.
Process
sync
.
RWMutex
}
...
...
@@ -98,6 +100,7 @@ func newQueryRunner(q *dhtQuery) *dhtQueryRunner {
func
(
r
*
dhtQueryRunner
)
Run
(
ctx
context
.
Context
,
peers
[]
peer
.
ID
)
(
*
dhtQueryResult
,
error
)
{
r
.
log
=
log
r
.
runCtx
=
ctx
if
len
(
peers
)
==
0
{
log
.
Warning
(
"Running query with no peers!"
)
...
...
@@ -167,6 +170,11 @@ func (r *dhtQueryRunner) addPeerToQuery(next peer.ID) {
return
}
notif
.
PublishQueryEvent
(
r
.
runCtx
,
&
notif
.
QueryEvent
{
Type
:
notif
.
AddingPeer
,
ID
:
next
,
})
r
.
peersRemaining
.
Increment
(
1
)
select
{
case
r
.
peersToQuery
.
EnqChan
<-
next
:
...
...
@@ -221,7 +229,12 @@ func (r *dhtQueryRunner) queryPeer(proc process.Process, p peer.ID) {
// make sure we're connected to the peer.
// FIXME abstract away into the network layer
if
conns
:=
r
.
query
.
dht
.
host
.
Network
()
.
ConnsToPeer
(
p
);
len
(
conns
)
==
0
{
log
.
Infof
(
"not connected. dialing."
)
log
.
Error
(
"not connected. dialing."
)
notif
.
PublishQueryEvent
(
r
.
runCtx
,
&
notif
.
QueryEvent
{
Type
:
notif
.
DialingPeer
,
ID
:
p
,
})
// while we dial, we do not take up a rate limit. this is to allow
// forward progress during potentially very high latency dials.
r
.
rateLimit
<-
struct
{}{}
...
...
@@ -231,9 +244,10 @@ func (r *dhtQueryRunner) queryPeer(proc process.Process, p peer.ID) {
if
err
:=
r
.
query
.
dht
.
host
.
Connect
(
ctx
,
pi
);
err
!=
nil
{
log
.
Debugf
(
"Error connecting: %s"
,
err
)
notif
.
PublishQueryEvent
(
c
tx
,
&
notif
.
QueryEvent
{
notif
.
PublishQueryEvent
(
r
.
runC
tx
,
&
notif
.
QueryEvent
{
Type
:
notif
.
QueryError
,
Extra
:
err
.
Error
(),
ID
:
p
,
})
r
.
Lock
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论