diff --git a/Cargo.toml b/Cargo.toml index cf4ca0d5..e01ed377 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,7 +69,6 @@ serde = ["libp2p-core/serde", "libp2p-kad/serde", "libp2p-gossipsub/serde"] all-features = true [dependencies] -atomic = "0.5.0" bytes = "1" futures = "0.3.1" futures-timer = "3.0.2" # Explicit dependency to be used in `wasm-bindgen` feature diff --git a/src/bandwidth.rs b/src/bandwidth.rs index 965c47d8..2e22d73b 100644 --- a/src/bandwidth.rs +++ b/src/bandwidth.rs @@ -26,7 +26,6 @@ use crate::{ Multiaddr, }; -use atomic::Atomic; use futures::{ io::{IoSlice, IoSliceMut}, prelude::*, @@ -36,7 +35,10 @@ use std::{ convert::TryFrom as _, io, pin::Pin, - sync::{atomic::Ordering, Arc}, + sync::{ + atomic::{AtomicU64, Ordering}, + Arc, + }, task::{Context, Poll}, }; @@ -52,8 +54,8 @@ impl BandwidthLogging { /// Creates a new [`BandwidthLogging`] around the transport. pub fn new(inner: TInner) -> (Self, Arc) { let sink = Arc::new(BandwidthSinks { - inbound: Atomic::new(0), - outbound: Atomic::new(0), + inbound: AtomicU64::new(0), + outbound: AtomicU64::new(0), }); let trans = BandwidthLogging { @@ -165,8 +167,8 @@ impl Future for BandwidthFuture { /// Allows obtaining the average bandwidth of the connections created from a [`BandwidthLogging`]. pub struct BandwidthSinks { - inbound: Atomic, - outbound: Atomic, + inbound: AtomicU64, + outbound: AtomicU64, } impl BandwidthSinks {