Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
b2ad4de5
Commit
b2ad4de5
authored
5 years ago
by
Pierre Krieger
Committed by
Bastian Köcher
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add more logging to the network (#4621)
parent
270c2a8a
Branches
gh-readonly-queue/master/pr-5078-4def82e7ff6cfacee9e33f53e20f25c10ce6b9e9
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
substrate/client/network/src/service.rs
+22
-13
22 additions, 13 deletions
substrate/client/network/src/service.rs
with
22 additions
and
13 deletions
substrate/client/network/src/service.rs
+
22
−
13
View file @
b2ad4de5
...
...
@@ -33,10 +33,10 @@ use std::task::Poll;
use
sp_consensus
::
import_queue
::{
ImportQueue
,
Link
};
use
sp_consensus
::
import_queue
::{
BlockImportResult
,
BlockImportError
};
use
futures
::{
prelude
::
*
,
channel
::
mpsc
};
use
log
::{
warn
,
error
,
info
};
use
log
::{
warn
,
error
,
info
,
trace
};
use
libp2p
::{
PeerId
,
Multiaddr
,
kad
::
record
};
use
libp2p
::
core
::{
transport
::
boxed
::
Boxed
,
muxing
::
StreamMuxerBox
};
use
libp2p
::
swarm
::
NetworkBehaviour
;
use
libp2p
::
swarm
::
{
NetworkBehaviour
,
SwarmEvent
}
;
use
parking_lot
::
Mutex
;
use
sc_peerset
::
PeersetHandle
;
use
sp_runtime
::{
traits
::{
Block
as
BlockT
,
NumberFor
},
ConsensusEngineId
};
...
...
@@ -774,23 +774,32 @@ impl<B: BlockT + 'static, S: NetworkSpecialization<B>, H: ExHashT> Future for Ne
loop
{
// Process the next action coming from the network.
let
poll_value
=
this
.network_service
.poll_next_unpin
(
cx
);
let
next_event
=
this
.network_service
.next_event
();
futures
::
pin_mut!
(
next_event
);
let
poll_value
=
next_event
.poll_unpin
(
cx
);
match
poll_value
{
Poll
::
Pending
=>
break
,
Poll
::
Ready
(
S
ome
(
BehaviourOut
::
BlockImport
(
origin
,
blocks
)))
=>
Poll
::
Ready
(
S
warmEvent
::
Behaviour
(
BehaviourOut
::
BlockImport
(
origin
,
blocks
)))
=>
this
.import_queue
.import_blocks
(
origin
,
blocks
),
Poll
::
Ready
(
S
ome
(
BehaviourOut
::
JustificationImport
(
origin
,
hash
,
nb
,
justification
)))
=>
Poll
::
Ready
(
S
warmEvent
::
Behaviour
(
BehaviourOut
::
JustificationImport
(
origin
,
hash
,
nb
,
justification
)))
=>
this
.import_queue
.import_justification
(
origin
,
hash
,
nb
,
justification
),
Poll
::
Ready
(
S
ome
(
BehaviourOut
::
FinalityProofImport
(
origin
,
hash
,
nb
,
proof
)))
=>
Poll
::
Ready
(
S
warmEvent
::
Behaviour
(
BehaviourOut
::
FinalityProofImport
(
origin
,
hash
,
nb
,
proof
)))
=>
this
.import_queue
.import_finality_proof
(
origin
,
hash
,
nb
,
proof
),
Poll
::
Ready
(
Some
(
BehaviourOut
::
Event
(
ev
)))
=>
{
this
.event_streams
.retain
(|
sender
|
sender
.unbounded_send
(
ev
.clone
())
.is_ok
());
},
Poll
::
Ready
(
None
)
=>
{
error!
(
target
:
"sync"
,
"Network events stream has returned None"
);
break
;
},
Poll
::
Ready
(
SwarmEvent
::
Behaviour
(
BehaviourOut
::
Event
(
ev
)))
=>
this
.event_streams
.retain
(|
sender
|
sender
.unbounded_send
(
ev
.clone
())
.is_ok
()),
Poll
::
Ready
(
SwarmEvent
::
Connected
(
peer_id
))
=>
trace!
(
target
:
"sub-libp2p"
,
"Libp2p => Connected({:?})"
,
peer_id
),
Poll
::
Ready
(
SwarmEvent
::
Disconnected
(
peer_id
))
=>
trace!
(
target
:
"sub-libp2p"
,
"Libp2p => Disconnected({:?})"
,
peer_id
),
Poll
::
Ready
(
SwarmEvent
::
NewListenAddr
(
addr
))
=>
trace!
(
target
:
"sub-libp2p"
,
"Libp2p => NewListenAddr({})"
,
addr
),
Poll
::
Ready
(
SwarmEvent
::
ExpiredListenAddr
(
addr
))
=>
trace!
(
target
:
"sub-libp2p"
,
"Libp2p => ExpiredListenAddr({})"
,
addr
),
Poll
::
Ready
(
SwarmEvent
::
UnreachableAddr
{
peer_id
,
address
,
error
})
=>
trace!
(
target
:
"sub-libp2p"
,
"Libp2p => Failed to reach {:?} through {:?}: {}"
,
peer_id
,
address
,
error
),
Poll
::
Ready
(
SwarmEvent
::
StartConnect
(
peer_id
))
=>
trace!
(
target
:
"sub-libp2p"
,
"Libp2p => StartConnect({:?})"
,
peer_id
),
};
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment