Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
polkadot
Commits
308e8b4b
Unverified
Commit
308e8b4b
authored
Jul 09, 2020
by
Pierre Krieger
Committed by
GitHub
Jul 09, 2020
Browse files
Remove AwaitCanceled (#1375)
parent
b651e4af
Pipeline
#99942
passed with stages
in 20 minutes and 20 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
network/Cargo.toml
View file @
308e8b4b
...
...
@@ -19,7 +19,7 @@ sc-network = { git = "https://github.com/paritytech/substrate", branch = "master
sc-network-gossip
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sp-core
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sp-runtime
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
futures
=
"0.3.
4
"
futures
=
"0.3.
5
"
log
=
"0.4.8"
exit-future
=
"0.2.0"
futures-timer
=
"2.0"
...
...
network/src/protocol/mod.rs
View file @
308e8b4b
...
...
@@ -404,28 +404,6 @@ struct ConsensusNetworkingInstance {
_drop_signal
:
exit_future
::
Signal
,
}
/// A utility future that resolves when the receiving end of a channel has hung up.
///
/// This is an `.await`-friendly interface around `poll_canceled`.
// TODO: remove in favor of https://github.com/rust-lang/futures-rs/pull/2092/
// once published.
#[must_use
=
"futures do nothing unless you `.await` or poll them"
]
#[derive(Debug)]
pub
struct
AwaitCanceled
<
'a
,
T
>
{
inner
:
&
'a
mut
oneshot
::
Sender
<
T
>
,
}
impl
<
T
>
Future
for
AwaitCanceled
<
'_
,
T
>
{
type
Output
=
();
fn
poll
(
mut
self
:
Pin
<&
mut
Self
>
,
cx
:
&
mut
futures
::
task
::
Context
<
'_
>
,
)
->
futures
::
task
::
Poll
<
()
>
{
self
.inner
.poll_canceled
(
cx
)
}
}
/// Protocol configuration.
#[derive(Default)]
pub
struct
Config
{
...
...
@@ -947,7 +925,7 @@ impl<Api, Sp, Gossip> Worker<Api, Sp, Gossip> where
self
.executor
.spawn
(
"polkadot-fetch-pov-block"
,
async
move
{
let
res
=
future
::
select
(
get_msg
,
AwaitCanceled
{
inner
:
&
mut
sender
}
)
.await
;
let
res
=
future
::
select
(
get_msg
,
sender
.cancellation
()
)
.await
;
if
let
Either
::
Left
((
pov_block
,
_
))
=
res
{
let
_
=
sender
.send
(
pov_block
);
}
...
...
@@ -981,7 +959,7 @@ impl<Api, Sp, Gossip> Worker<Api, Sp, Gossip> where
self
.executor
.spawn
(
"polkadot-fetch-erasure-chunk"
,
async
move
{
let
res
=
future
::
select
(
get_msg
,
AwaitCanceled
{
inner
:
&
mut
sender
}
)
.await
;
let
res
=
future
::
select
(
get_msg
,
sender
.cancellation
()
)
.await
;
if
let
Either
::
Left
((
chunk
,
_
))
=
res
{
let
_
=
sender
.send
(
chunk
);
}
...
...
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment