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
836c8468
Commit
836c8468
authored
Feb 21, 2019
by
Janoš Guljaš
Committed by
Viktor Trón
Feb 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swarm/network/master: protect SetNextBatch iterator after close (#19147)
parent
b9808e39
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
stream.go
swarm/network/stream/stream.go
+10
-0
syncer.go
swarm/network/stream/syncer.go
+5
-0
No files found.
swarm/network/stream/stream.go
View file @
836c8468
...
...
@@ -597,6 +597,16 @@ func (r *Registry) runProtocol(p *p2p.Peer, rw p2p.MsgReadWriter) error {
// HandleMsg is the message handler that delegates incoming messages
func
(
p
*
Peer
)
HandleMsg
(
ctx
context
.
Context
,
msg
interface
{})
error
{
select
{
case
<-
p
.
streamer
.
quit
:
log
.
Trace
(
"message received after the streamer is closed"
,
"peer"
,
p
.
ID
())
// return without an error since streamer is closed and
// no messages should be handled as other subcomponents like
// storage leveldb may be closed
return
nil
default
:
}
switch
msg
:=
msg
.
(
type
)
{
case
*
SubscribeMsg
:
...
...
swarm/network/stream/syncer.go
View file @
836c8468
...
...
@@ -107,6 +107,11 @@ func (s *SwarmSyncerServer) SetNextBatch(from, to uint64) ([]byte, uint64, uint6
metrics
.
GetOrRegisterCounter
(
"syncer.setnextbatch.iterator"
,
nil
)
.
Inc
(
1
)
err
:=
s
.
store
.
Iterator
(
from
,
to
,
s
.
po
,
func
(
key
storage
.
Address
,
idx
uint64
)
bool
{
select
{
case
<-
s
.
quit
:
return
false
default
:
}
batch
=
append
(
batch
,
key
[
:
]
...
)
i
++
to
=
idx
...
...
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