Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update async-channel/async-std #5889

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 51 additions & 44 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -612,8 +612,8 @@ asset-hub-westend-emulated-chain = { path = "cumulus/parachains/integration-test
asset-hub-westend-runtime = { path = "cumulus/parachains/runtimes/assets/asset-hub-westend" }
asset-test-utils = { path = "cumulus/parachains/runtimes/assets/test-utils", default-features = false }
assets-common = { path = "cumulus/parachains/runtimes/assets/common", default-features = false }
async-channel = { version = "1.8.0" }
async-std = { version = "1.9.0" }
async-channel = { version = "2.3.1" }
async-std = { version = "1.13.0" }
async-trait = { version = "0.1.79" }
asynchronous-codec = { version = "0.6" }
backoff = { version = "0.4" }
Expand Down Expand Up @@ -812,7 +812,7 @@ integer-sqrt = { version = "0.1.2" }
ip_network = { version = "0.4.1" }
is-terminal = { version = "0.4.9" }
is_executable = { version = "1.0.1" }
isahc = { version = "1.2" }
isahc = { version = "1.7.2" }
itertools = { version = "0.11" }
jemalloc_pprof = { version = "0.4" }
jobserver = { version = "0.1.26" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

use std::marker::PhantomData;
use std::{marker::PhantomData, pin::Pin};

use futures::{channel::oneshot, StreamExt};

Expand Down Expand Up @@ -58,7 +58,7 @@ where
req_protocol_names: &ReqProtocolNames,
) -> (IncomingRequestReceiver<Req>, N::RequestResponseProtocolConfig) {
let (raw, cfg) = Req::PROTOCOL.get_config::<B, N>(req_protocol_names);
(IncomingRequestReceiver { raw, phantom: PhantomData {} }, cfg)
(IncomingRequestReceiver { raw: Box::pin(raw), phantom: PhantomData {} }, cfg)
}

/// Create new `IncomingRequest`.
Expand Down Expand Up @@ -206,7 +206,7 @@ pub struct OutgoingResponse<Response> {
///
/// Takes care of decoding and handling of invalid encoded requests.
pub struct IncomingRequestReceiver<Req> {
raw: async_channel::Receiver<netconfig::IncomingRequest>,
raw: Pin<Box<async_channel::Receiver<netconfig::IncomingRequest>>>,
phantom: PhantomData<Req>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use sc_network::{
use sc_network_types::PeerId;
use sp_consensus_beefy::BEEFY_ENGINE_ID;
use sp_runtime::traits::Block;
use std::{marker::PhantomData, sync::Arc};
use std::{marker::PhantomData, pin::Pin, sync::Arc};

use crate::{
communication::{
Expand Down Expand Up @@ -100,12 +100,12 @@ impl<B: Block> IncomingRequest<B> {
///
/// Takes care of decoding and handling of invalid encoded requests.
pub(crate) struct IncomingRequestReceiver {
raw: async_channel::Receiver<netconfig::IncomingRequest>,
raw: Pin<Box<async_channel::Receiver<netconfig::IncomingRequest>>>,
}

impl IncomingRequestReceiver {
pub fn new(inner: async_channel::Receiver<netconfig::IncomingRequest>) -> Self {
Self { raw: inner }
Self { raw: Box::pin(inner) }
}

/// Try to receive the next incoming request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use sp_core::{
storage::{ChildInfo, ChildType, PrefixedStorageKey},
};
use sp_runtime::traits::Block;
use std::{marker::PhantomData, sync::Arc};
use std::{marker::PhantomData, pin::Pin, sync::Arc};

const LOG_TARGET: &str = "light-client-request-handler";

Expand All @@ -49,7 +49,7 @@ const MAX_LIGHT_REQUEST_QUEUE: usize = 20;

/// Handler for incoming light client requests from a remote peer.
pub struct LightClientRequestHandler<B, Client> {
request_receiver: async_channel::Receiver<IncomingRequest>,
request_receiver: Pin<Box<async_channel::Receiver<IncomingRequest>>>,
/// Blockchain client.
client: Arc<Client>,
_block: PhantomData<B>,
Expand Down Expand Up @@ -79,7 +79,14 @@ where
tx,
);

(Self { client, request_receiver, _block: PhantomData::default() }, protocol_config)
(
Self {
client,
request_receiver: Box::pin(request_receiver),
_block: PhantomData::default(),
},
protocol_config,
)
}

/// Run [`LightClientRequestHandler`].
Expand Down
6 changes: 3 additions & 3 deletions substrate/client/network/src/bitswap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use schema::bitswap::{
Message as BitswapMessage,
};
use sp_runtime::traits::Block as BlockT;
use std::{io, sync::Arc, time::Duration};
use std::{io, pin::Pin, sync::Arc, time::Duration};
use unsigned_varint::encode as varint_encode;

mod schema;
Expand Down Expand Up @@ -95,7 +95,7 @@ impl Prefix {
/// Bitswap request handler
pub struct BitswapRequestHandler<B> {
client: Arc<dyn BlockBackend<B> + Send + Sync>,
request_receiver: async_channel::Receiver<IncomingRequest>,
request_receiver: Pin<Box<async_channel::Receiver<IncomingRequest>>>,
}

impl<B: BlockT> BitswapRequestHandler<B> {
Expand All @@ -112,7 +112,7 @@ impl<B: BlockT> BitswapRequestHandler<B> {
inbound_queue: Some(tx),
};

(Self { client, request_receiver }, config)
(Self { client, request_receiver: Box::pin(request_receiver) }, config)
}

/// Run [`BitswapRequestHandler`].
Expand Down
Loading
Loading