Update protocols and transport to 2018 edition (#875)

Update the protocols and transport subdirectories to the 2018 edition.

NB: The websocket transport cannot be moved to 2018 edition due to
websocket-rs's use of the keyword async as the name of a module.
This commit is contained in:
Dan Robertson
2019-01-21 10:33:51 +00:00
committed by Pierre Krieger
parent a806c4ac08
commit 6d24596f9f
22 changed files with 42 additions and 28 deletions

View File

@ -157,7 +157,7 @@ where
fn shutdown(&mut self) {
self.shutting_down = true;
for n in (0..self.substreams.len()).rev() {
let mut substream = self.substreams.swap_remove(n);
let substream = self.substreams.swap_remove(n);
self.substreams.push(SubstreamState::Closing(substream.into_substream()));
}
}

View File

@ -18,18 +18,18 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
use crate::handler::FloodsubHandler;
use crate::protocol::{FloodsubMessage, FloodsubRpc, FloodsubSubscription, FloodsubSubscriptionAction};
use crate::topic::{Topic, TopicHash};
use cuckoofilter::CuckooFilter;
use futures::prelude::*;
use handler::FloodsubHandler;
use libp2p_core::swarm::{ConnectedPoint, NetworkBehaviour, NetworkBehaviourAction, PollParameters};
use libp2p_core::{protocols_handler::ProtocolsHandler, PeerId};
use protocol::{FloodsubMessage, FloodsubRpc, FloodsubSubscription, FloodsubSubscriptionAction};
use rand;
use smallvec::SmallVec;
use std::{collections::VecDeque, iter, marker::PhantomData};
use std::collections::hash_map::{DefaultHasher, HashMap};
use tokio_io::{AsyncRead, AsyncWrite};
use topic::{Topic, TopicHash};
/// Network behaviour that automatically identifies nodes periodically, and returns information
/// about them.
@ -213,7 +213,7 @@ where
) {
// Update connected peers topics
for subscription in event.subscriptions {
let mut remote_peer_topics = self.connected_peers
let remote_peer_topics = self.connected_peers
.get_mut(&propagation_source)
.expect("connected_peers is kept in sync with the peers we are connected to; we are guaranteed to only receive events from connected peers; QED");
match subscription.action {

View File

@ -20,13 +20,13 @@
use bytes::{BufMut, BytesMut};
use crate::rpc_proto;
use crate::topic::TopicHash;
use futures::future;
use libp2p_core::{InboundUpgrade, OutboundUpgrade, UpgradeInfo, PeerId};
use protobuf::Message as ProtobufMessage;
use std::{io, iter};
use tokio_codec::{Decoder, Encoder, Framed};
use tokio_io::{AsyncRead, AsyncWrite};
use topic::TopicHash;
use unsigned_varint::codec;
/// Implementation of `ConnectionUpgrade` for the floodsub protocol.

View File

@ -19,8 +19,8 @@
// DEALINGS IN THE SOFTWARE.
use bs58;
use crate::rpc_proto;
use protobuf::Message;
use rpc_proto;
/// Represents the hash of a topic.
///