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
099be041
Unverified
Commit
099be041
authored
Mar 26, 2021
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth/protocols/snap: add peer id and req id to the timeout logs
parent
063f78c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
15 deletions
+25
-15
sync.go
eth/protocols/snap/sync.go
+25
-15
No files found.
eth/protocols/snap/sync.go
View file @
099be041
...
...
@@ -811,6 +811,8 @@ func (s *Syncer) assignAccountTasks(cancel chan struct{}) {
if
idle
==
""
{
return
}
peer
:=
s
.
peers
[
idle
]
// Matched a pending task to an idle peer, allocate a unique request id
var
reqid
uint64
for
{
...
...
@@ -834,14 +836,14 @@ func (s *Syncer) assignAccountTasks(cancel chan struct{}) {
task
:
task
,
}
req
.
timeout
=
time
.
AfterFunc
(
requestTimeout
,
func
()
{
log
.
Debug
(
"Account range request timed out"
)
peer
.
Log
()
.
Debug
(
"Account range request timed out"
,
"reqid"
,
reqid
)
s
.
scheduleRevertAccountRequest
(
req
)
})
s
.
accountReqs
[
reqid
]
=
req
delete
(
s
.
accountIdlers
,
idle
)
s
.
pend
.
Add
(
1
)
go
func
(
peer
SyncPeer
,
root
common
.
Hash
)
{
go
func
(
root
common
.
Hash
)
{
defer
s
.
pend
.
Done
()
// Attempt to send the remote request and revert if it fails
...
...
@@ -849,7 +851,7 @@ func (s *Syncer) assignAccountTasks(cancel chan struct{}) {
peer
.
Log
()
.
Debug
(
"Failed to request account range"
,
"err"
,
err
)
s
.
scheduleRevertAccountRequest
(
req
)
}
}(
s
.
peers
[
idle
],
s
.
root
)
// We're in the lock, peers[id] surely exists
}(
s
.
root
)
// Inject the request into the task to block further assignments
task
.
req
=
req
...
...
@@ -891,6 +893,8 @@ func (s *Syncer) assignBytecodeTasks(cancel chan struct{}) {
if
idle
==
""
{
return
}
peer
:=
s
.
peers
[
idle
]
// Matched a pending task to an idle peer, allocate a unique request id
var
reqid
uint64
for
{
...
...
@@ -921,14 +925,14 @@ func (s *Syncer) assignBytecodeTasks(cancel chan struct{}) {
task
:
task
,
}
req
.
timeout
=
time
.
AfterFunc
(
requestTimeout
,
func
()
{
log
.
Debug
(
"Bytecode request timed out"
)
peer
.
Log
()
.
Debug
(
"Bytecode request timed out"
,
"reqid"
,
reqid
)
s
.
scheduleRevertBytecodeRequest
(
req
)
})
s
.
bytecodeReqs
[
reqid
]
=
req
delete
(
s
.
bytecodeIdlers
,
idle
)
s
.
pend
.
Add
(
1
)
go
func
(
peer
SyncPeer
)
{
go
func
()
{
defer
s
.
pend
.
Done
()
// Attempt to send the remote request and revert if it fails
...
...
@@ -936,7 +940,7 @@ func (s *Syncer) assignBytecodeTasks(cancel chan struct{}) {
log
.
Debug
(
"Failed to request bytecodes"
,
"err"
,
err
)
s
.
scheduleRevertBytecodeRequest
(
req
)
}
}(
s
.
peers
[
idle
])
// We're in the lock, peers[id] surely exists
}(
)
}
}
...
...
@@ -976,6 +980,8 @@ func (s *Syncer) assignStorageTasks(cancel chan struct{}) {
if
idle
==
""
{
return
}
peer
:=
s
.
peers
[
idle
]
// Matched a pending task to an idle peer, allocate a unique request id
var
reqid
uint64
for
{
...
...
@@ -1045,14 +1051,14 @@ func (s *Syncer) assignStorageTasks(cancel chan struct{}) {
req
.
limit
=
subtask
.
Last
}
req
.
timeout
=
time
.
AfterFunc
(
requestTimeout
,
func
()
{
log
.
Debug
(
"Storage request timed out"
)
peer
.
Log
()
.
Debug
(
"Storage request timed out"
,
"reqid"
,
reqid
)
s
.
scheduleRevertStorageRequest
(
req
)
})
s
.
storageReqs
[
reqid
]
=
req
delete
(
s
.
storageIdlers
,
idle
)
s
.
pend
.
Add
(
1
)
go
func
(
peer
SyncPeer
,
root
common
.
Hash
)
{
go
func
(
root
common
.
Hash
)
{
defer
s
.
pend
.
Done
()
// Attempt to send the remote request and revert if it fails
...
...
@@ -1064,7 +1070,7 @@ func (s *Syncer) assignStorageTasks(cancel chan struct{}) {
log
.
Debug
(
"Failed to request storage"
,
"err"
,
err
)
s
.
scheduleRevertStorageRequest
(
req
)
}
}(
s
.
peers
[
idle
],
s
.
root
)
// We're in the lock, peers[id] surely exists
}(
s
.
root
)
// Inject the request into the subtask to block further assignments
if
subtask
!=
nil
{
...
...
@@ -1121,6 +1127,8 @@ func (s *Syncer) assignTrienodeHealTasks(cancel chan struct{}) {
if
idle
==
""
{
return
}
peer
:=
s
.
peers
[
idle
]
// Matched a pending task to an idle peer, allocate a unique request id
var
reqid
uint64
for
{
...
...
@@ -1160,14 +1168,14 @@ func (s *Syncer) assignTrienodeHealTasks(cancel chan struct{}) {
task
:
s
.
healer
,
}
req
.
timeout
=
time
.
AfterFunc
(
requestTimeout
,
func
()
{
log
.
Debug
(
"Trienode heal request timed out"
)
peer
.
Log
()
.
Debug
(
"Trienode heal request timed out"
,
"reqid"
,
reqid
)
s
.
scheduleRevertTrienodeHealRequest
(
req
)
})
s
.
trienodeHealReqs
[
reqid
]
=
req
delete
(
s
.
trienodeHealIdlers
,
idle
)
s
.
pend
.
Add
(
1
)
go
func
(
peer
SyncPeer
,
root
common
.
Hash
)
{
go
func
(
root
common
.
Hash
)
{
defer
s
.
pend
.
Done
()
// Attempt to send the remote request and revert if it fails
...
...
@@ -1175,7 +1183,7 @@ func (s *Syncer) assignTrienodeHealTasks(cancel chan struct{}) {
log
.
Debug
(
"Failed to request trienode healers"
,
"err"
,
err
)
s
.
scheduleRevertTrienodeHealRequest
(
req
)
}
}(
s
.
peers
[
idle
],
s
.
root
)
// We're in the lock, peers[id] surely exists
}(
s
.
root
)
}
}
...
...
@@ -1227,6 +1235,8 @@ func (s *Syncer) assignBytecodeHealTasks(cancel chan struct{}) {
if
idle
==
""
{
return
}
peer
:=
s
.
peers
[
idle
]
// Matched a pending task to an idle peer, allocate a unique request id
var
reqid
uint64
for
{
...
...
@@ -1258,14 +1268,14 @@ func (s *Syncer) assignBytecodeHealTasks(cancel chan struct{}) {
task
:
s
.
healer
,
}
req
.
timeout
=
time
.
AfterFunc
(
requestTimeout
,
func
()
{
log
.
Debug
(
"Bytecode heal request timed out"
)
peer
.
Log
()
.
Debug
(
"Bytecode heal request timed out"
,
"reqid"
,
reqid
)
s
.
scheduleRevertBytecodeHealRequest
(
req
)
})
s
.
bytecodeHealReqs
[
reqid
]
=
req
delete
(
s
.
bytecodeHealIdlers
,
idle
)
s
.
pend
.
Add
(
1
)
go
func
(
peer
SyncPeer
)
{
go
func
()
{
defer
s
.
pend
.
Done
()
// Attempt to send the remote request and revert if it fails
...
...
@@ -1273,7 +1283,7 @@ func (s *Syncer) assignBytecodeHealTasks(cancel chan struct{}) {
log
.
Debug
(
"Failed to request bytecode healers"
,
"err"
,
err
)
s
.
scheduleRevertBytecodeHealRequest
(
req
)
}
}(
s
.
peers
[
idle
])
// We're in the lock, peers[id] surely exists
}(
)
}
}
...
...
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