Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
a390ca5f
Commit
a390ca5f
authored
Jan 26, 2017
by
Zsolt Felfoldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
les, cmd/util: disable topic discovery with --nodiscover
parent
12379c69
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
flags.go
cmd/utils/flags.go
+6
-2
serverpool.go
les/serverpool.go
+9
-3
No files found.
cmd/utils/flags.go
View file @
a390ca5f
...
@@ -654,6 +654,10 @@ func MakeNode(ctx *cli.Context, name, gitCommit string) *node.Node {
...
@@ -654,6 +654,10 @@ func MakeNode(ctx *cli.Context, name, gitCommit string) *node.Node {
vsn
+=
"-"
+
gitCommit
[
:
8
]
vsn
+=
"-"
+
gitCommit
[
:
8
]
}
}
// if we're running a light client or server, force enable the v5 peer discovery unless it is explicitly disabled with --nodiscover
// note that explicitly specifying --v5disc overrides --nodiscover, in which case the later only disables v4 discovery
forceV5Discovery
:=
(
ctx
.
GlobalBool
(
LightModeFlag
.
Name
)
||
ctx
.
GlobalInt
(
LightServFlag
.
Name
)
>
0
)
&&
!
ctx
.
GlobalBool
(
NoDiscoverFlag
.
Name
)
config
:=
&
node
.
Config
{
config
:=
&
node
.
Config
{
DataDir
:
MakeDataDir
(
ctx
),
DataDir
:
MakeDataDir
(
ctx
),
KeyStoreDir
:
ctx
.
GlobalString
(
KeyStoreDirFlag
.
Name
),
KeyStoreDir
:
ctx
.
GlobalString
(
KeyStoreDirFlag
.
Name
),
...
@@ -662,8 +666,8 @@ func MakeNode(ctx *cli.Context, name, gitCommit string) *node.Node {
...
@@ -662,8 +666,8 @@ func MakeNode(ctx *cli.Context, name, gitCommit string) *node.Node {
Name
:
name
,
Name
:
name
,
Version
:
vsn
,
Version
:
vsn
,
UserIdent
:
makeNodeUserIdent
(
ctx
),
UserIdent
:
makeNodeUserIdent
(
ctx
),
NoDiscovery
:
ctx
.
GlobalBool
(
NoDiscoverFlag
.
Name
)
||
ctx
.
GlobalBool
(
LightModeFlag
.
Name
),
NoDiscovery
:
ctx
.
GlobalBool
(
NoDiscoverFlag
.
Name
)
||
ctx
.
GlobalBool
(
LightModeFlag
.
Name
),
// always disable v4 discovery in light client mode
DiscoveryV5
:
ctx
.
GlobalBool
(
DiscoveryV5Flag
.
Name
)
||
ctx
.
GlobalBool
(
LightModeFlag
.
Name
)
||
ctx
.
GlobalInt
(
LightServFlag
.
Name
)
>
0
,
DiscoveryV5
:
ctx
.
GlobalBool
(
DiscoveryV5Flag
.
Name
)
||
forceV5Discovery
,
DiscoveryV5Addr
:
MakeDiscoveryV5Address
(
ctx
),
DiscoveryV5Addr
:
MakeDiscoveryV5Address
(
ctx
),
BootstrapNodes
:
MakeBootstrapNodes
(
ctx
),
BootstrapNodes
:
MakeBootstrapNodes
(
ctx
),
BootstrapNodesV5
:
MakeBootstrapNodesV5
(
ctx
),
BootstrapNodesV5
:
MakeBootstrapNodesV5
(
ctx
),
...
...
les/serverpool.go
View file @
a390ca5f
...
@@ -348,7 +348,9 @@ func (pool *serverPool) selectPeerWait(reqID uint64, canSend func(*peer) (bool,
...
@@ -348,7 +348,9 @@ func (pool *serverPool) selectPeerWait(reqID uint64, canSend func(*peer) (bool,
func
(
pool
*
serverPool
)
eventLoop
()
{
func
(
pool
*
serverPool
)
eventLoop
()
{
lookupCnt
:=
0
lookupCnt
:=
0
var
convTime
mclock
.
AbsTime
var
convTime
mclock
.
AbsTime
pool
.
discSetPeriod
<-
time
.
Millisecond
*
100
if
pool
.
discSetPeriod
!=
nil
{
pool
.
discSetPeriod
<-
time
.
Millisecond
*
100
}
for
{
for
{
select
{
select
{
case
entry
:=
<-
pool
.
timeout
:
case
entry
:=
<-
pool
.
timeout
:
...
@@ -393,12 +395,16 @@ func (pool *serverPool) eventLoop() {
...
@@ -393,12 +395,16 @@ func (pool *serverPool) eventLoop() {
lookupCnt
++
lookupCnt
++
if
pool
.
fastDiscover
&&
(
lookupCnt
==
50
||
time
.
Duration
(
mclock
.
Now
()
-
convTime
)
>
time
.
Minute
)
{
if
pool
.
fastDiscover
&&
(
lookupCnt
==
50
||
time
.
Duration
(
mclock
.
Now
()
-
convTime
)
>
time
.
Minute
)
{
pool
.
fastDiscover
=
false
pool
.
fastDiscover
=
false
pool
.
discSetPeriod
<-
time
.
Minute
if
pool
.
discSetPeriod
!=
nil
{
pool
.
discSetPeriod
<-
time
.
Minute
}
}
}
}
}
case
<-
pool
.
quit
:
case
<-
pool
.
quit
:
close
(
pool
.
discSetPeriod
)
if
pool
.
discSetPeriod
!=
nil
{
close
(
pool
.
discSetPeriod
)
}
pool
.
connWg
.
Wait
()
pool
.
connWg
.
Wait
()
pool
.
saveNodes
()
pool
.
saveNodes
()
pool
.
wg
.
Done
()
pool
.
wg
.
Done
()
...
...
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