Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
shasper
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository 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
shasper
Commits
5777aad1
Commit
5777aad1
authored
5 years ago
by
Wei Tang
Browse files
Options
Downloads
Patches
Plain Diff
Fix network interface update
parent
39769e97
No related merge requests found
Pipeline
#56093
failed with stage
in 5 minutes and 38 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
blockchain/network/src/behaviour.rs
+4
-4
4 additions, 4 deletions
blockchain/network/src/behaviour.rs
blockchain/network/src/discovery.rs
+1
-1
1 addition, 1 deletion
blockchain/network/src/discovery.rs
blockchain/network/src/service.rs
+9
-17
9 additions, 17 deletions
blockchain/network/src/service.rs
with
14 additions
and
22 deletions
blockchain/network/src/behaviour.rs
+
4
−
4
View file @
5777aad1
...
...
@@ -174,7 +174,7 @@ impl<C: Config, TSubstream: AsyncRead + AsyncWrite> NetworkBehaviourEventProcess
{
fn
inject_event
(
&
mut
self
,
event
:
IdentifyEvent
)
{
match
event
{
IdentifyEvent
::
Identifi
ed
{
IdentifyEvent
::
Receiv
ed
{
peer_id
,
mut
info
,
..
}
=>
{
if
info
.listen_addrs
.len
()
>
MAX_IDENTIFY_ADDRESSES
{
...
...
@@ -192,9 +192,9 @@ impl<C: Config, TSubstream: AsyncRead + AsyncWrite> NetworkBehaviourEventProcess
info
.protocols
,
);
self
.events
.push
(
Libp2pEvent
::
PeerDialed
(
peer_id
));
}
IdentifyEvent
::
Error
{
..
}
=>
{}
IdentifyEvent
::
SendBack
{
..
}
=>
{}
}
,
IdentifyEvent
::
Sent
{
..
}
=>
(),
IdentifyEvent
::
Error
{
..
}
=>
(),
}
}
}
...
...
This diff is collapsed.
Click to expand it.
blockchain/network/src/discovery.rs
+
1
−
1
View file @
5777aad1
...
...
@@ -268,7 +268,7 @@ fn load_enr(
// Build the local ENR.
// Note: Discovery should update the ENR record's IP to the external IP as seen by the
// majority of our peers.
let
local_enr
=
EnrBuilder
::
new
()
let
local_enr
=
EnrBuilder
::
new
(
"v4"
)
.ip
(
config
.discovery_address
)
.tcp
(
config
.libp2p_port
)
.udp
(
config
.discovery_port
)
...
...
This diff is collapsed.
Click to expand it.
blockchain/network/src/service.rs
+
9
−
17
View file @
5777aad1
...
...
@@ -154,23 +154,15 @@ fn build_transport(local_private_key: Keypair) -> Boxed<(PeerId, StreamMuxerBox)
transport
.or_transport
(
websocket
::
WsConfig
::
new
(
trans_clone
))
};
transport
.with_upgrade
(
secio
::
SecioConfig
::
new
(
local_private_key
))
.and_then
(
move
|
out
,
endpoint
|
{
let
peer_id
=
out
.remote_key
.into_peer_id
();
let
peer_id2
=
peer_id
.clone
();
let
upgrade
=
core
::
upgrade
::
SelectUpgrade
::
new
(
libp2p
::
yamux
::
Config
::
default
(),
libp2p
::
mplex
::
MplexConfig
::
new
(),
)
// TODO: use a single `.map` instead of two maps
.map_inbound
(
move
|
muxer
|
(
peer_id
,
muxer
))
.map_outbound
(
move
|
muxer
|
(
peer_id2
,
muxer
));
core
::
upgrade
::
apply
(
out
.stream
,
upgrade
,
endpoint
)
.map
(|(
id
,
muxer
)|
(
id
,
core
::
muxing
::
StreamMuxerBox
::
new
(
muxer
)))
})
.with_timeout
(
Duration
::
from_secs
(
20
))
.map_err
(|
err
|
Error
::
Libp2p
(
Box
::
new
(
err
)))
.upgrade
(
core
::
upgrade
::
Version
::
V1
)
.authenticate
(
secio
::
SecioConfig
::
new
(
local_private_key
))
.multiplex
(
core
::
upgrade
::
SelectUpgrade
::
new
(
libp2p
::
yamux
::
Config
::
default
(),
libp2p
::
mplex
::
MplexConfig
::
new
(),
))
.map
(|(
peer
,
muxer
),
_
|
(
peer
,
core
::
muxing
::
StreamMuxerBox
::
new
(
muxer
)))
.timeout
(
Duration
::
from_secs
(
20
))
.map_err
(|
e
|
Error
::
Libp2p
(
Box
::
new
(
e
)))
.boxed
()
}
...
...
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