Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
afa1f154
提交
afa1f154
authored
11月 16, 2016
作者:
Jeromy Johnson
提交者:
GitHub
11月 16, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3381 from ipfs/feat/disable-bw-stats
add config option to disable bandwidth metrics
上级
1a365a86
43d66833
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
17 行增加
和
4 行删除
+17
-4
stat.go
core/commands/stat.go
+5
-0
core.go
core/core.go
+5
-3
config.md
docs/config.md
+5
-0
swarm.go
repo/config/swarm.go
+2
-1
没有找到文件。
core/commands/stat.go
浏览文件 @
afa1f154
...
@@ -93,6 +93,11 @@ Example:
...
@@ -93,6 +93,11 @@ Example:
return
return
}
}
if
nd
.
Reporter
==
nil
{
res
.
SetError
(
fmt
.
Errorf
(
"bandwidth reporter disabled in config"
),
cmds
.
ErrNormal
)
return
}
pstr
,
pfound
,
err
:=
req
.
Option
(
"peer"
)
.
String
()
pstr
,
pfound
,
err
:=
req
.
Option
(
"peer"
)
.
String
()
if
err
!=
nil
{
if
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
...
...
core/core.go
浏览文件 @
afa1f154
...
@@ -143,9 +143,6 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin
...
@@ -143,9 +143,6 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin
return
err
return
err
}
}
// Set reporter
n
.
Reporter
=
metrics
.
NewBandwidthCounter
()
// get undialable addrs from config
// get undialable addrs from config
cfg
,
err
:=
n
.
Repo
.
Config
()
cfg
,
err
:=
n
.
Repo
.
Config
()
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -160,6 +157,11 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin
...
@@ -160,6 +157,11 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin
addrfilter
=
append
(
addrfilter
,
f
)
addrfilter
=
append
(
addrfilter
,
f
)
}
}
if
!
cfg
.
Swarm
.
DisableBandwidthMetrics
{
// Set reporter
n
.
Reporter
=
metrics
.
NewBandwidthCounter
()
}
peerhost
,
err
:=
hostOption
(
ctx
,
n
.
Identity
,
n
.
Peerstore
,
n
.
Reporter
,
addrfilter
)
peerhost
,
err
:=
hostOption
(
ctx
,
n
.
Identity
,
n
.
Peerstore
,
n
.
Reporter
,
addrfilter
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
...
docs/config.md
浏览文件 @
afa1f154
...
@@ -213,5 +213,10 @@ Options for configuring the swarm.
...
@@ -213,5 +213,10 @@ Options for configuring the swarm.
An array of address filters (multiaddr netmasks) to filter dials to.
An array of address filters (multiaddr netmasks) to filter dials to.
See https://github.com/ipfs/go-ipfs/issues/1226#issuecomment-120494604 for more information.
See https://github.com/ipfs/go-ipfs/issues/1226#issuecomment-120494604 for more information.
-
`DisableBandwidthMetrics`
A boolean value that when set to true, will cause ipfs to not keep track of
bandwidth metrics. Disabling bandwidth metrics can lead to a slight performance
improvement, as well as a reduction in memory usage.
## `Tour`
## `Tour`
Unused.
Unused.
repo/config/swarm.go
浏览文件 @
afa1f154
package
config
package
config
type
SwarmConfig
struct
{
type
SwarmConfig
struct
{
AddrFilters
[]
string
AddrFilters
[]
string
DisableBandwidthMetrics
bool
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论