Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ryardley committed Dec 22, 2024
1 parent f80a26f commit c374a77
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/ciphernode/net/src/correlation_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{

static NEXT_CORRELATION_ID: AtomicUsize = AtomicUsize::new(1);

/// CorrelationId provides a way to correlate commands and the events they create.
/// CorrelationId provides a way to correlate commands and the events they create.
#[derive(Debug, Clone)]
pub struct CorrelationId {
id: usize,
Expand Down
4 changes: 2 additions & 2 deletions packages/ciphernode/net/src/dialer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ use libp2p::{
swarm::{dial_opts::DialOpts, ConnectionId, DialError},
Multiaddr,
};
use tracing::info;
use std::net::ToSocketAddrs;
use tokio::sync::{broadcast, mpsc};
use tracing::error;
use tracing::info;

use crate::{
events::{NetworkPeerCommand, NetworkPeerEvent},
Expand Down Expand Up @@ -78,7 +78,7 @@ async fn attempt_connection(
}

/// Wait for results of a retry based on a given correlation id and return the correct variant of
/// RetryError depending on the result from the downstream event
/// RetryError depending on the result from the downstream event
async fn wait_for_connection(
event_rx: &mut broadcast::Receiver<NetworkPeerEvent>,
dial_connection: ConnectionId,
Expand Down
10 changes: 3 additions & 7 deletions packages/ciphernode/net/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,10 @@ pub enum NetworkPeerEvent {
message_id: MessageId,
},
/// There was an error Dialing a peer
DialError {
error: Arc<DialError>,
},
DialError { error: Arc<DialError> },
/// A connection was established to a peer
ConnectionEstablished {
connection_id: ConnectionId,
},
/// There was an error creating a connection
ConnectionEstablished { connection_id: ConnectionId },
/// There was an error creating a connection
OutgoingConnectionError {
connection_id: ConnectionId,
error: Arc<DialError>,
Expand Down
2 changes: 1 addition & 1 deletion packages/ciphernode/net/src/network_peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub struct NetworkPeer {
udp_port: Option<u16>,
/// The gossipsub topic that the peer should listen on
topic: gossipsub::IdentTopic,
/// Broadcast channel to report NetworkPeerEvents to listeners
/// Broadcast channel to report NetworkPeerEvents to listeners
event_tx: broadcast::Sender<NetworkPeerEvent>,
/// Transmission channel to send NetworkPeerCommands to the NetworkPeer
cmd_tx: mpsc::Sender<NetworkPeerCommand>,
Expand Down
2 changes: 1 addition & 1 deletion packages/ciphernode/net/src/retry.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::Result;
use tracing::{error, warn};
use std::{future::Future, time::Duration};
use tokio::time::sleep;
use tracing::{error, warn};

pub enum RetryError {
Failure(anyhow::Error),
Expand Down

0 comments on commit c374a77

Please sign in to comment.