Behavior -> Behaviour (#650)

This commit is contained in:
Pierre Krieger
2018-11-16 12:59:57 +01:00
committed by GitHub
parent 23bcd44f18
commit 37994b34e7
10 changed files with 46 additions and 46 deletions

View File

@ -21,7 +21,7 @@
use cuckoofilter::CuckooFilter;
use futures::prelude::*;
use handler::FloodsubHandler;
use libp2p_core::nodes::{ConnectedPoint, NetworkBehavior, NetworkBehaviorAction};
use libp2p_core::nodes::{ConnectedPoint, NetworkBehaviour, NetworkBehaviourAction};
use libp2p_core::{protocols_handler::ProtocolsHandler, PeerId};
use protocol::{FloodsubMessage, FloodsubRpc, FloodsubSubscription, FloodsubSubscriptionAction};
use rand;
@ -35,7 +35,7 @@ use topic::{Topic, TopicHash};
/// about them.
pub struct FloodsubBehaviour<TSubstream> {
/// Events that need to be yielded to the outside when polling.
events: VecDeque<NetworkBehaviorAction<FloodsubRpc, FloodsubMessage>>,
events: VecDeque<NetworkBehaviourAction<FloodsubRpc, FloodsubMessage>>,
/// Peer id of the local node. Used for the source of the messages that we publish.
local_peer_id: PeerId,
@ -81,7 +81,7 @@ impl<TSubstream> FloodsubBehaviour<TSubstream> {
}
for peer in self.connected_peers.keys() {
self.events.push_back(NetworkBehaviorAction::SendEvent {
self.events.push_back(NetworkBehaviourAction::SendEvent {
peer_id: peer.clone(),
event: FloodsubRpc {
messages: Vec::new(),
@ -112,7 +112,7 @@ impl<TSubstream> FloodsubBehaviour<TSubstream> {
self.subscribed_topics.remove(pos);
for peer in self.connected_peers.keys() {
self.events.push_back(NetworkBehaviorAction::SendEvent {
self.events.push_back(NetworkBehaviourAction::SendEvent {
peer_id: peer.clone(),
event: FloodsubRpc {
messages: Vec::new(),
@ -161,7 +161,7 @@ impl<TSubstream> FloodsubBehaviour<TSubstream> {
continue;
}
self.events.push_back(NetworkBehaviorAction::SendEvent {
self.events.push_back(NetworkBehaviourAction::SendEvent {
peer_id: peer_id.clone(),
event: FloodsubRpc {
subscriptions: Vec::new(),
@ -172,7 +172,7 @@ impl<TSubstream> FloodsubBehaviour<TSubstream> {
}
}
impl<TSubstream> NetworkBehavior for FloodsubBehaviour<TSubstream>
impl<TSubstream> NetworkBehaviour for FloodsubBehaviour<TSubstream>
where
TSubstream: AsyncRead + AsyncWrite,
{
@ -186,7 +186,7 @@ where
fn inject_connected(&mut self, id: PeerId, _: ConnectedPoint) {
// We need to send our subscriptions to the newly-connected node.
for topic in self.subscribed_topics.iter() {
self.events.push_back(NetworkBehaviorAction::SendEvent {
self.events.push_back(NetworkBehaviourAction::SendEvent {
peer_id: id.clone(),
event: FloodsubRpc {
messages: Vec::new(),
@ -242,7 +242,7 @@ where
// Add the message to be dispatched to the user.
if self.subscribed_topics.iter().any(|t| message.topics.iter().any(|u| t.hash() == u)) {
self.events.push_back(NetworkBehaviorAction::GenerateEvent(message.clone()));
self.events.push_back(NetworkBehaviourAction::GenerateEvent(message.clone()));
}
// Propagate the message to everyone else who is subscribed to any of the topics.
@ -267,7 +267,7 @@ where
}
for (peer_id, rpc) in rpcs_to_dispatch {
self.events.push_back(NetworkBehaviorAction::SendEvent {
self.events.push_back(NetworkBehaviourAction::SendEvent {
peer_id,
event: rpc,
});
@ -277,7 +277,7 @@ where
fn poll(
&mut self,
) -> Async<
NetworkBehaviorAction<
NetworkBehaviourAction<
<Self::ProtocolsHandler as ProtocolsHandler>::InEvent,
Self::OutEvent,
>,