Skip to content

Commit

Permalink
Implemented really the lateset review
Browse files Browse the repository at this point in the history
  • Loading branch information
umgefahren committed Oct 23, 2023
1 parent 9597d53 commit 6352e65
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 deletions.
2 changes: 2 additions & 0 deletions core/src/connection.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright 2020 Parity Technologies (UK) Ltd.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
Expand Down
2 changes: 1 addition & 1 deletion core/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub struct DialOpts {
///
/// When attempting a hole-punch, both parties simultaneously "dial" each other but one party has to be the "listener" on the final connection.
/// This option specifies the role of this node in the final connection.
pub endpoint: Endpoint,
pub role: Endpoint,
/// The port use policy for a new connection.
pub port_use: PortUse,
}
Expand Down
5 changes: 2 additions & 3 deletions core/src/transport/and_then.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

use crate::transport::DialOpts;
use crate::{
connection::ConnectedPoint,
transport::{ListenerId, Transport, TransportError, TransportEvent},
transport::{ListenerId, Transport, TransportError, TransportEvent, DialOpts},
};
use either::Either;
use futures::prelude::*;
Expand Down Expand Up @@ -84,7 +83,7 @@ where
self.fun.clone(),
ConnectedPoint::Dialer {
address: addr,
role_override: opts.endpoint,
role_override: opts.role,
port_use: opts.port_use,
},
)),
Expand Down
3 changes: 1 addition & 2 deletions core/src/transport/global_only.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

use crate::transport::DialOpts;
use crate::{
multiaddr::{Multiaddr, Protocol},
transport::{ListenerId, TransportError, TransportEvent},
transport::{ListenerId, TransportError, TransportEvent, DialOpts},
};
use log::debug;
use std::{
Expand Down
2 changes: 1 addition & 1 deletion core/src/transport/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ where
let future = self.transport.dial(addr.clone(), opts)?;
let p = ConnectedPoint::Dialer {
address: addr,
role_override: opts.endpoint,
role_override: opts.role,
port_use: opts.port_use,
};
Ok(MapFuture {
Expand Down
10 changes: 5 additions & 5 deletions core/src/transport/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ mod tests {
.dial(
"/memory/810172461024613".parse().unwrap(),
DialOpts {
endpoint: Endpoint::Dialer,
role: Endpoint::Dialer,
port_use: PortUse::New
}
)
Expand All @@ -517,7 +517,7 @@ mod tests {
.dial(
"/memory/810172461024613".parse().unwrap(),
DialOpts {
endpoint: Endpoint::Dialer,
role: Endpoint::Dialer,
port_use: PortUse::New
}
)
Expand Down Expand Up @@ -591,7 +591,7 @@ mod tests {
.dial(
cloned_t1_addr,
DialOpts {
endpoint: Endpoint::Dialer,
role: Endpoint::Dialer,
port_use: PortUse::New,
},
)
Expand Down Expand Up @@ -636,7 +636,7 @@ mod tests {
.dial(
listener_addr_cloned,
DialOpts {
endpoint: Endpoint::Dialer,
role: Endpoint::Dialer,
port_use: PortUse::New,
},
)
Expand Down Expand Up @@ -693,7 +693,7 @@ mod tests {
.dial(
listener_addr_cloned,
DialOpts {
endpoint: Endpoint::Dialer,
role: Endpoint::Dialer,
port_use: PortUse::New,
},
)
Expand Down
2 changes: 1 addition & 1 deletion core/tests/transport_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ fn upgrade_pipeline() {
.dial(
listen_addr2,
DialOpts {
endpoint: Endpoint::Dialer,
role: Endpoint::Dialer,
port_use: PortUse::New,
},
)
Expand Down
2 changes: 1 addition & 1 deletion swarm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ where
let dial = self.transport.dial(
address.clone(),
transport::DialOpts {
endpoint: dial_opts.role_override(),
role: dial_opts.role_override(),
port_use: dial_opts.port_use(),
},
);
Expand Down
2 changes: 1 addition & 1 deletion swarm/tests/swarm_derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// DEALINGS IN THE SOFTWARE.

use futures::StreamExt;
use libp2p_core::{Endpoint, Multiaddr, transport::PortUse};
use libp2p_core::{transport::PortUse, Endpoint, Multiaddr};
use libp2p_identify as identify;
use libp2p_ping as ping;
use libp2p_swarm::{
Expand Down
6 changes: 3 additions & 3 deletions transports/tcp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ mod tests {
.dial(
addr.clone(),
DialOpts {
endpoint: Endpoint::Dialer,
role: Endpoint::Dialer,
port_use: PortUse::Reuse,
},
)
Expand Down Expand Up @@ -925,7 +925,7 @@ mod tests {
tcp.dial(
dest_addr,
DialOpts {
endpoint: Endpoint::Dialer,
role: Endpoint::Dialer,
port_use: PortUse::New,
},
)
Expand Down Expand Up @@ -1032,7 +1032,7 @@ mod tests {
.dial(
dest_addr,
DialOpts {
endpoint: Endpoint::Dialer,
role: Endpoint::Dialer,
port_use: PortUse::Reuse,
},
)
Expand Down

0 comments on commit 6352e65

Please sign in to comment.