Skip to content

Commit

Permalink
Complete the renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
AgeManning committed Jan 18, 2024
1 parent 942661c commit 08cd2b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ impl Handler {
HandlerIn::EnrResponse(enr, EnrRequestData::WhoAreYou(wru_ref)) => self.send_challenge::<P>(wru_ref, enr).await,
HandlerIn::EnrResponse(Some(target_enr), EnrRequestData::Nat(relay_initiation)) => {
// Assemble the notification for the target
let (initiator_enr, _target, timed_out_nonce) = relay_initiator.into();
let (initiator_enr, _target, timed_out_nonce) = relay_initiation.into();
let relay_msg_notification = RelayMsgNotification::new(initiator_enr, timed_out_nonce);
if let Err(e) = self.send_relay_msg_notification::<P>(target_enr, relay_msg_notification).await {
warn!("Failed to relay. Error: {:?}", e);
Expand Down Expand Up @@ -1148,7 +1148,7 @@ impl Handler {
.await;
let ban_timeout = self.nat.ban_duration.map(|v| Instant::now() + v);
PERMIT_BAN_LIST.write().ban(node_address, ban_timeout);
} else if let Err(e) = self.on_relay_initiator(notification).await {
} else if let Err(e) = self.on_relay_initiation(notification).await {
warn!(
"failed handling notification to relay for {node_address}, {:?}",
e
Expand Down Expand Up @@ -1652,12 +1652,12 @@ impl Handler {
/// trigger sending a RelayMsg to the target.
async fn on_relay_initiation(
&mut self,
relay_initiator: RelayInitNotification,
relay_initiation: RelayInitNotification,
) -> Result<(), NatError> {
// Check for target peer in our kbuckets otherwise drop notification.
if let Err(e) = self
.service_send
.send(HandlerOut::RequestEnr(EnrRequestData::Nat(relay_initiator)))
.send(HandlerOut::RequestEnr(EnrRequestData::Nat(relay_initiation)))
.await
{
return Err(NatError::Relay(e.into()));
Expand Down
8 changes: 4 additions & 4 deletions src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ impl Service {
}
HandlerOut::RequestEnr(EnrRequestData::Nat(relay_initiation)) => {
// Update initiator's Enr if it's in kbuckets
let initiator_enr = relay_initiator.initiator_enr();
let initiator_enr = relay_initiation.initiator_enr();
let initiator_key = kbucket::Key::from(initiator_enr.node_id());
match self.kbuckets.write().entry(&initiator_key) {
kbucket::Entry::Present(ref mut entry, _) => {
Expand All @@ -422,17 +422,17 @@ impl Service {
}
// check if we know the target node id in our routing table, otherwise
// drop relay attempt.
let target_node_id = relay_initiator.target_node_id();
let target_node_id = relay_initiation.target_node_id();
let target_key = kbucket::Key::from(target_node_id);
if let kbucket::Entry::Present(entry, _) = self.kbuckets.write().entry(&target_key) {
let target_enr = entry.value().clone();
if let Err(e) = self.handler_send.send(HandlerIn::EnrResponse(Some(target_enr), EnrRequestData::Nat(relay_initiator))) {
if let Err(e) = self.handler_send.send(HandlerIn::EnrResponse(Some(target_enr), EnrRequestData::Nat(relay_initiation))) {
warn!(
"Failed to send target enr to relay process, error: {e}"
);
}
} else {
let initiator_node_id = relay_initiator.initiator_enr().node_id();
let initiator_node_id = relay_initiation.initiator_enr().node_id();
warn!(
initiator_node_id=%initiator_node_id,
target_node_id=%target_node_id,
Expand Down

0 comments on commit 08cd2b6

Please sign in to comment.