refactor(dcutr): don't use OutboundOpenInfo

In a previous refactoring, we actually removed the usage of this openinfo so this is just removing dead code.

Related: #3268.

Pull-Request: #3762.
This commit is contained in:
Thomas Eizinger
2023-04-28 13:33:31 +02:00
committed by GitHub
parent a836bb471f
commit 66466c43af
2 changed files with 4 additions and 8 deletions

View File

@ -133,7 +133,6 @@ impl Behaviour {
handler: NotifyHandler::One(connection_id), handler: NotifyHandler::One(connection_id),
event: Either::Left(handler::relayed::Command::Connect { event: Either::Left(handler::relayed::Command::Connect {
obs_addrs: self.observed_addreses(), obs_addrs: self.observed_addreses(),
attempt: 1,
}), }),
}, },
ToSwarm::GenerateEvent(Event::InitiatedDirectConnectionUpgrade { ToSwarm::GenerateEvent(Event::InitiatedDirectConnectionUpgrade {
@ -190,7 +189,6 @@ impl Behaviour {
handler: NotifyHandler::One(relayed_connection_id), handler: NotifyHandler::One(relayed_connection_id),
peer_id, peer_id,
event: Either::Left(handler::relayed::Command::Connect { event: Either::Left(handler::relayed::Command::Connect {
attempt: attempt + 1,
obs_addrs: self.observed_addreses(), obs_addrs: self.observed_addreses(),
}), }),
}) })

View File

@ -44,7 +44,6 @@ use std::time::Duration;
pub enum Command { pub enum Command {
Connect { Connect {
obs_addrs: Vec<Multiaddr>, obs_addrs: Vec<Multiaddr>,
attempt: u8,
}, },
AcceptInboundConnect { AcceptInboundConnect {
obs_addrs: Vec<Multiaddr>, obs_addrs: Vec<Multiaddr>,
@ -59,10 +58,9 @@ pub enum Command {
impl fmt::Debug for Command { impl fmt::Debug for Command {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self { match self {
Command::Connect { obs_addrs, attempt } => f Command::Connect { obs_addrs } => f
.debug_struct("Command::Connect") .debug_struct("Command::Connect")
.field("obs_addrs", obs_addrs) .field("obs_addrs", obs_addrs)
.field("attempt", attempt)
.finish(), .finish(),
Command::AcceptInboundConnect { Command::AcceptInboundConnect {
obs_addrs, obs_addrs,
@ -301,7 +299,7 @@ impl ConnectionHandler for Handler {
>; >;
type InboundProtocol = Either<protocol::inbound::Upgrade, DeniedUpgrade>; type InboundProtocol = Either<protocol::inbound::Upgrade, DeniedUpgrade>;
type OutboundProtocol = protocol::outbound::Upgrade; type OutboundProtocol = protocol::outbound::Upgrade;
type OutboundOpenInfo = u8; // Number of upgrade attempts. type OutboundOpenInfo = ();
type InboundOpenInfo = (); type InboundOpenInfo = ();
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Self::InboundOpenInfo> { fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Self::InboundOpenInfo> {
@ -322,12 +320,12 @@ impl ConnectionHandler for Handler {
fn on_behaviour_event(&mut self, event: Self::InEvent) { fn on_behaviour_event(&mut self, event: Self::InEvent) {
match event { match event {
Command::Connect { obs_addrs, attempt } => { Command::Connect { obs_addrs } => {
self.queued_events self.queued_events
.push_back(ConnectionHandlerEvent::OutboundSubstreamRequest { .push_back(ConnectionHandlerEvent::OutboundSubstreamRequest {
protocol: SubstreamProtocol::new( protocol: SubstreamProtocol::new(
protocol::outbound::Upgrade::new(obs_addrs), protocol::outbound::Upgrade::new(obs_addrs),
attempt, (),
), ),
}); });
} }