Skip to content

Commit f18a863

Browse files
committed
protocols/dcutr: Rename Action to ActionBuilder
1 parent b50708b commit f18a863

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

protocols/dcutr/src/behaviour.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub enum UpgradeError {
6767

6868
pub struct Behaviour {
6969
/// Queue of actions to return when polled.
70-
queued_actions: VecDeque<Action>,
70+
queued_actions: VecDeque<ActionBuilder>,
7171

7272
/// All direct (non-relayed) connections.
7373
direct_connections: HashMap<PeerId, HashSet<ConnectionId>>,
@@ -113,7 +113,7 @@ impl NetworkBehaviour for Behaviour {
113113
//
114114
// https://github.com/libp2p/specs/blob/master/relay/DCUtR.md#the-protocol
115115
self.queued_actions.extend([
116-
Action::Connect {
116+
ActionBuilder::Connect {
117117
peer_id: *peer_id,
118118
attempt: 1,
119119
handler: NotifyHandler::One(*connection_id),
@@ -152,7 +152,7 @@ impl NetworkBehaviour for Behaviour {
152152
let peer_id =
153153
peer_id.expect("Peer of `Prototype::DirectConnection` is always known.");
154154
if attempt < MAX_NUMBER_OF_UPGRADE_ATTEMPTS {
155-
self.queued_actions.push_back(Action::Connect {
155+
self.queued_actions.push_back(ActionBuilder::Connect {
156156
peer_id,
157157
handler: NotifyHandler::One(relayed_connection_id),
158158
attempt: attempt + 1,
@@ -219,7 +219,7 @@ impl NetworkBehaviour for Behaviour {
219219
remote_addr,
220220
}) => {
221221
self.queued_actions.extend([
222-
Action::AcceptInboundConnect {
222+
ActionBuilder::AcceptInboundConnect {
223223
peer_id: event_source,
224224
handler: NotifyHandler::One(connection),
225225
inbound_connect,
@@ -327,7 +327,7 @@ impl NetworkBehaviour for Behaviour {
327327
/// A [`NetworkBehaviourAction`], either complete, or still requiring data from [`PollParameters`]
328328
/// before being returned in [`Behaviour::poll`].
329329
#[allow(clippy::large_enum_variant)]
330-
enum Action {
330+
enum ActionBuilder {
331331
Done(NetworkBehaviourAction<Event, handler::Prototype>),
332332
Connect {
333333
attempt: u8,
@@ -341,13 +341,13 @@ enum Action {
341341
},
342342
}
343343

344-
impl From<NetworkBehaviourAction<Event, handler::Prototype>> for Action {
344+
impl From<NetworkBehaviourAction<Event, handler::Prototype>> for ActionBuilder {
345345
fn from(action: NetworkBehaviourAction<Event, handler::Prototype>) -> Self {
346346
Self::Done(action)
347347
}
348348
}
349349

350-
impl Action {
350+
impl ActionBuilder {
351351
fn build(
352352
self,
353353
poll_parameters: &mut impl PollParameters,
@@ -364,8 +364,8 @@ impl Action {
364364
};
365365

366366
match self {
367-
Action::Done(action) => action,
368-
Action::AcceptInboundConnect {
367+
ActionBuilder::Done(action) => action,
368+
ActionBuilder::AcceptInboundConnect {
369369
inbound_connect,
370370
handler,
371371
peer_id,
@@ -377,7 +377,7 @@ impl Action {
377377
obs_addrs: obs_addrs(),
378378
}),
379379
},
380-
Action::Connect {
380+
ActionBuilder::Connect {
381381
attempt,
382382
handler,
383383
peer_id,

0 commit comments

Comments
 (0)