Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(dcutr): don't use OutboundOpenInfo #3762

Merged
merged 4 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions protocols/dcutr/src/behaviour_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ impl Behaviour {
handler: NotifyHandler::One(connection_id),
event: Either::Left(handler::relayed::Command::Connect {
obs_addrs: self.observed_addreses(),
attempt: 1,
}),
},
ToSwarm::GenerateEvent(Event::InitiatedDirectConnectionUpgrade {
Expand Down Expand Up @@ -190,7 +189,6 @@ impl Behaviour {
handler: NotifyHandler::One(relayed_connection_id),
peer_id,
event: Either::Left(handler::relayed::Command::Connect {
attempt: attempt + 1,
obs_addrs: self.observed_addreses(),
}),
})
Expand Down
10 changes: 4 additions & 6 deletions protocols/dcutr/src/handler/relayed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ use std::time::Duration;
pub enum Command {
Connect {
obs_addrs: Vec<Multiaddr>,
attempt: u8,
},
AcceptInboundConnect {
obs_addrs: Vec<Multiaddr>,
Expand All @@ -59,10 +58,9 @@ pub enum Command {
impl fmt::Debug for Command {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Command::Connect { obs_addrs, attempt } => f
Command::Connect { obs_addrs } => f
.debug_struct("Command::Connect")
.field("obs_addrs", obs_addrs)
.field("attempt", attempt)
.finish(),
Command::AcceptInboundConnect {
obs_addrs,
Expand Down Expand Up @@ -301,7 +299,7 @@ impl ConnectionHandler for Handler {
>;
type InboundProtocol = Either<protocol::inbound::Upgrade, DeniedUpgrade>;
type OutboundProtocol = protocol::outbound::Upgrade;
type OutboundOpenInfo = u8; // Number of upgrade attempts.
type OutboundOpenInfo = ();
type InboundOpenInfo = ();

fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Self::InboundOpenInfo> {
Expand All @@ -322,12 +320,12 @@ impl ConnectionHandler for Handler {

fn on_behaviour_event(&mut self, event: Self::InEvent) {
match event {
Command::Connect { obs_addrs, attempt } => {
Command::Connect { obs_addrs } => {
self.queued_events
.push_back(ConnectionHandlerEvent::OutboundSubstreamRequest {
protocol: SubstreamProtocol::new(
protocol::outbound::Upgrade::new(obs_addrs),
attempt,
(),
),
});
}
Expand Down