Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Commit

Permalink
fix: removed unneeded BehaviourEvent struct
Browse files Browse the repository at this point in the history
  • Loading branch information
rand0m-cloud authored and koivunej committed Apr 1, 2022
1 parent 93b31b3 commit 25c8d58
Showing 1 changed file with 1 addition and 47 deletions.
48 changes: 1 addition & 47 deletions src/p2p/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use tokio::task;

/// Behaviour type.
#[derive(libp2p::NetworkBehaviour)]
#[behaviour(out_event = "BehaviourEvent", event_process = true)]
#[behaviour(event_process = true)]
pub struct Behaviour<Types: IpfsTypes> {
#[behaviour(ignore)]
repo: Arc<Repo<Types>>,
Expand All @@ -38,52 +38,6 @@ pub struct Behaviour<Types: IpfsTypes> {
pub swarm: SwarmApi,
}

#[derive(Debug)]
pub enum BehaviourEvent {
Kademlia(KademliaEvent),
Ping(PingEvent),
Identify(IdentifyEvent),
Bitswap(BitswapEvent),
Floodsub(FloodsubEvent),
Void,
}

impl From<KademliaEvent> for BehaviourEvent {
fn from(event: KademliaEvent) -> Self {
Self::Kademlia(event)
}
}

impl From<PingEvent> for BehaviourEvent {
fn from(event: PingEvent) -> Self {
Self::Ping(event)
}
}

impl From<IdentifyEvent> for BehaviourEvent {
fn from(event: IdentifyEvent) -> Self {
Self::Identify(event)
}
}

impl From<BitswapEvent> for BehaviourEvent {
fn from(event: BitswapEvent) -> Self {
Self::Bitswap(event)
}
}

impl From<FloodsubEvent> for BehaviourEvent {
fn from(event: FloodsubEvent) -> Self {
Self::Floodsub(event)
}
}

impl From<void::Void> for BehaviourEvent {
fn from(_void: void::Void) -> Self {
Self::Void
}
}

/// Represents the result of a Kademlia query.
#[derive(Debug, Clone, PartialEq)]
pub enum KadResult {
Expand Down

0 comments on commit 25c8d58

Please sign in to comment.