mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-15 02:51:25 +00:00
*: Enable libp2p to run via wasm32-unknown-unknown in the browser (#2320)
Changes needed to get libp2p to run via `wasm32-unknown-unknown` in the browser (both main thread and inside web workers). Replaces wasm-timer with futures-timer and instant. Co-authored-by: Oliver Wangler <oliver@wngr.de>
This commit is contained in:
@ -25,6 +25,7 @@ use crate::types::{GossipsubRpc, PeerKind, RawGossipsubMessage};
|
||||
use asynchronous_codec::Framed;
|
||||
use futures::prelude::*;
|
||||
use futures::StreamExt;
|
||||
use instant::Instant;
|
||||
use libp2p_core::upgrade::{InboundUpgrade, NegotiationError, OutboundUpgrade, UpgradeError};
|
||||
use libp2p_swarm::protocols_handler::{
|
||||
KeepAlive, ProtocolsHandler, ProtocolsHandlerEvent, ProtocolsHandlerUpgrErr, SubstreamProtocol,
|
||||
@ -39,7 +40,6 @@ use std::{
|
||||
task::{Context, Poll},
|
||||
time::Duration,
|
||||
};
|
||||
use wasm_timer::Instant;
|
||||
|
||||
/// The initial time (in seconds) we set the keep alive for protocol negotiations to occur.
|
||||
const INITIAL_KEEP_ALIVE: u64 = 30;
|
||||
|
Reference in New Issue
Block a user