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
90eef10d
Commit
90eef10d
authored
6 years ago
by
Pierre Krieger
Committed by
Bastian Köcher
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Address review in #1884 (#1906)
parent
2e9b2be8
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
substrate/core/network-libp2p/src/lib.rs
+5
-5
5 additions, 5 deletions
substrate/core/network-libp2p/src/lib.rs
substrate/core/network-libp2p/src/service_task.rs
+13
-7
13 additions, 7 deletions
substrate/core/network-libp2p/src/service_task.rs
with
18 additions
and
12 deletions
substrate/core/network-libp2p/src/lib.rs
+
5
−
5
View file @
90eef10d
...
@@ -118,12 +118,12 @@ pub enum NetworkStatePeerEndpoint {
...
@@ -118,12 +118,12 @@ pub enum NetworkStatePeerEndpoint {
impl
From
<
ConnectedPoint
>
for
NetworkStatePeerEndpoint
{
impl
From
<
ConnectedPoint
>
for
NetworkStatePeerEndpoint
{
fn
from
(
endpoint
:
ConnectedPoint
)
->
Self
{
fn
from
(
endpoint
:
ConnectedPoint
)
->
Self
{
match
endpoint
{
match
endpoint
{
ConnectedPoint
::
Dialer
{
ref
address
}
=>
ConnectedPoint
::
Dialer
{
address
}
=>
NetworkStatePeerEndpoint
::
Dialing
(
address
.clone
()
),
NetworkStatePeerEndpoint
::
Dialing
(
address
),
ConnectedPoint
::
Listener
{
ref
listen_addr
,
ref
send_back_addr
}
=>
ConnectedPoint
::
Listener
{
listen_addr
,
send_back_addr
}
=>
NetworkStatePeerEndpoint
::
Listening
{
NetworkStatePeerEndpoint
::
Listening
{
listen_addr
:
listen_addr
.clone
()
,
listen_addr
:
listen_addr
,
send_back_addr
:
send_back_addr
.clone
()
send_back_addr
:
send_back_addr
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
substrate/core/network-libp2p/src/service_task.rs
+
13
−
7
View file @
90eef10d
...
@@ -25,7 +25,7 @@ use futures::{prelude::*, Stream};
...
@@ -25,7 +25,7 @@ use futures::{prelude::*, Stream};
use
libp2p
::{
multiaddr
::
Protocol
,
Multiaddr
,
PeerId
,
build_multiaddr
};
use
libp2p
::{
multiaddr
::
Protocol
,
Multiaddr
,
PeerId
,
build_multiaddr
};
use
libp2p
::
core
::{
Swarm
,
nodes
::
Substream
,
transport
::
boxed
::
Boxed
,
muxing
::
StreamMuxerBox
};
use
libp2p
::
core
::{
Swarm
,
nodes
::
Substream
,
transport
::
boxed
::
Boxed
,
muxing
::
StreamMuxerBox
};
use
libp2p
::
core
::
nodes
::
ConnectedPoint
;
use
libp2p
::
core
::
nodes
::
ConnectedPoint
;
use
log
::{
debug
,
info
,
warn
};
use
log
::{
debug
,
error
,
info
,
warn
};
use
std
::
collections
::
hash_map
::
Entry
;
use
std
::
collections
::
hash_map
::
Entry
;
use
std
::
fs
;
use
std
::
fs
;
use
std
::
io
::{
Error
as
IoError
,
ErrorKind
as
IoErrorKind
};
use
std
::
io
::{
Error
as
IoError
,
ErrorKind
as
IoErrorKind
};
...
@@ -477,9 +477,12 @@ where TMessage: CustomMessage + Send + 'static {
...
@@ -477,9 +477,12 @@ where TMessage: CustomMessage + Send + 'static {
// have any open custom protocol slot. Therefore it is not necessarily in the
// have any open custom protocol slot. Therefore it is not necessarily in the
// list.
// list.
if
let
Some
(
id
)
=
self
.index_by_id
.get
(
&
peer_id
)
{
if
let
Some
(
id
)
=
self
.index_by_id
.get
(
&
peer_id
)
{
self
.nodes_info
.get_mut
(
id
)
if
let
Some
(
n
)
=
self
.nodes_info
.get_mut
(
id
)
{
.expect
(
"index_by_id and nodes_info are always kept in sync; QED"
)
n
.client_version
=
Some
(
info
.agent_version
);
.client_version
=
Some
(
info
.agent_version
);
}
else
{
error!
(
target
:
"sub-libp2p"
,
"State inconsistency between index_by_id and nodes_info"
);
}
}
}
}
}
Ok
(
Async
::
Ready
(
Some
(
BehaviourOut
::
PingSuccess
{
peer_id
,
ping_time
})))
=>
{
Ok
(
Async
::
Ready
(
Some
(
BehaviourOut
::
PingSuccess
{
peer_id
,
ping_time
})))
=>
{
...
@@ -487,9 +490,12 @@ where TMessage: CustomMessage + Send + 'static {
...
@@ -487,9 +490,12 @@ where TMessage: CustomMessage + Send + 'static {
// have any open custom protocol slot. Therefore it is not necessarily in the
// have any open custom protocol slot. Therefore it is not necessarily in the
// list.
// list.
if
let
Some
(
id
)
=
self
.index_by_id
.get
(
&
peer_id
)
{
if
let
Some
(
id
)
=
self
.index_by_id
.get
(
&
peer_id
)
{
self
.nodes_info
.get_mut
(
id
)
if
let
Some
(
n
)
=
self
.nodes_info
.get_mut
(
id
)
{
.expect
(
"index_by_id and nodes_info are always kept in sync; QED"
)
n
.latest_ping
=
Some
(
ping_time
);
.latest_ping
=
Some
(
ping_time
);
}
else
{
error!
(
target
:
"sub-libp2p"
,
"State inconsistency between index_by_id and nodes_info"
);
}
}
}
}
}
Ok
(
Async
::
NotReady
)
=>
break
Ok
(
Async
::
NotReady
),
Ok
(
Async
::
NotReady
)
=>
break
Ok
(
Async
::
NotReady
),
...
...
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