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
4b9c0ea7
Unverified
Commit
4b9c0ea7
authored
Aug 07, 2020
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth/downloader: save the correct delivery time for state sync
parent
68754f39
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
statesync.go
eth/downloader/statesync.go
+10
-9
No files found.
eth/downloader/statesync.go
View file @
4b9c0ea7
...
...
@@ -34,13 +34,14 @@ import (
// stateReq represents a batch of state fetch requests grouped together into
// a single data retrieval network packet.
type
stateReq
struct
{
nItems
uint16
// Number of items requested for download (max is 384, so uint16 is sufficient)
tasks
map
[
common
.
Hash
]
*
stateTask
// Download tasks to track previous attempts
timeout
time
.
Duration
// Maximum round trip time for this to complete
timer
*
time
.
Timer
// Timer to fire when the RTT timeout expires
peer
*
peerConnection
// Peer that we're requesting from
response
[][]
byte
// Response data of the peer (nil for timeouts)
dropped
bool
// Flag whether the peer dropped off early
nItems
uint16
// Number of items requested for download (max is 384, so uint16 is sufficient)
tasks
map
[
common
.
Hash
]
*
stateTask
// Download tasks to track previous attempts
timeout
time
.
Duration
// Maximum round trip time for this to complete
timer
*
time
.
Timer
// Timer to fire when the RTT timeout expires
peer
*
peerConnection
// Peer that we're requesting from
delivered
time
.
Time
// Time when the packet was delivered (independent when we process it)
response
[][]
byte
// Response data of the peer (nil for timeouts)
dropped
bool
// Flag whether the peer dropped off early
}
// timedOut returns if this request timed out.
...
...
@@ -148,6 +149,7 @@ func (d *Downloader) runStateSync(s *stateSync) *stateSync {
// Finalize the request and queue up for processing
req
.
timer
.
Stop
()
req
.
response
=
pack
.
(
*
statePack
)
.
states
req
.
delivered
=
time
.
Now
()
finished
=
append
(
finished
,
req
)
delete
(
active
,
pack
.
PeerId
())
...
...
@@ -349,7 +351,6 @@ func (s *stateSync) loop() (err error) {
return
errCanceled
case
req
:=
<-
s
.
deliver
:
deliveryTime
:=
time
.
Now
()
// Response, disconnect or timeout triggered, drop the peer if stalling
log
.
Trace
(
"Received node data response"
,
"peer"
,
req
.
peer
.
id
,
"count"
,
len
(
req
.
response
),
"dropped"
,
req
.
dropped
,
"timeout"
,
!
req
.
dropped
&&
req
.
timedOut
())
if
req
.
nItems
<=
2
&&
!
req
.
dropped
&&
req
.
timedOut
()
{
...
...
@@ -376,7 +377,7 @@ func (s *stateSync) loop() (err error) {
}
// Process all the received blobs and check for stale delivery
delivered
,
err
:=
s
.
process
(
req
)
req
.
peer
.
SetNodeDataIdle
(
delivered
,
deliveryTime
)
req
.
peer
.
SetNodeDataIdle
(
delivered
,
req
.
delivered
)
if
err
!=
nil
{
log
.
Warn
(
"Node data write error"
,
"err"
,
err
)
return
err
...
...
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