Skip to content

Commit

Permalink
refactor: move upd tracker client
Browse files Browse the repository at this point in the history
to follow same folder strucutre as the HTTP tracker client.
  • Loading branch information
josecelano committed Jan 17, 2024
1 parent 470e608 commit 129fd2f
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/servers/health_check_api/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use torrust_tracker_configuration::{Configuration, HttpApi, HttpTracker, UdpTrac

use super::resources::Report;
use super::responses;
use crate::shared::bit_torrent::udp::client::new_udp_tracker_client_connected;
use crate::shared::bit_torrent::tracker::udp::client::new_udp_tracker_client_connected;

/// If port 0 is specified in the configuration the OS will automatically
/// assign a free port. But we do now know in from the configuration.
Expand Down
2 changes: 1 addition & 1 deletion src/servers/udp/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use crate::bootstrap::jobs::Started;
use crate::core::Tracker;
use crate::servers::signals::{shutdown_signal_with_message, Halted};
use crate::servers::udp::handlers::handle_packet;
use crate::shared::bit_torrent::udp::MAX_PACKET_SIZE;
use crate::shared::bit_torrent::tracker::udp::MAX_PACKET_SIZE;

/// Error that can occur when starting or stopping the UDP server.
///
Expand Down
1 change: 0 additions & 1 deletion src/shared/bit_torrent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,3 @@
pub mod common;
pub mod info_hash;
pub mod tracker;
pub mod udp;
1 change: 1 addition & 0 deletions src/shared/bit_torrent/tracker/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pub mod http;
pub mod udp;
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::sync::Arc;
use aquatic_udp_protocol::{Request, Response};
use tokio::net::UdpSocket;

use crate::shared::bit_torrent::udp::{source_address, MAX_PACKET_SIZE};
use crate::shared::bit_torrent::tracker::udp::{source_address, MAX_PACKET_SIZE};

#[allow(clippy::module_name_repetitions)]
pub struct UdpClient {
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions tests/servers/udp/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
use core::panic;

use aquatic_udp_protocol::{ConnectRequest, ConnectionId, Response, TransactionId};
use torrust_tracker::shared::bit_torrent::udp::client::{new_udp_client_connected, UdpTrackerClient};
use torrust_tracker::shared::bit_torrent::udp::MAX_PACKET_SIZE;
use torrust_tracker::shared::bit_torrent::tracker::udp::client::{new_udp_client_connected, UdpTrackerClient};
use torrust_tracker::shared::bit_torrent::tracker::udp::MAX_PACKET_SIZE;
use torrust_tracker_test_helpers::configuration;

use crate::servers::udp::asserts::is_error_response;
Expand Down Expand Up @@ -51,7 +51,7 @@ async fn should_return_a_bad_request_response_when_the_client_sends_an_empty_req

mod receiving_a_connection_request {
use aquatic_udp_protocol::{ConnectRequest, TransactionId};
use torrust_tracker::shared::bit_torrent::udp::client::new_udp_tracker_client_connected;
use torrust_tracker::shared::bit_torrent::tracker::udp::client::new_udp_tracker_client_connected;
use torrust_tracker_test_helpers::configuration;

use crate::servers::udp::asserts::is_connect_response;
Expand Down Expand Up @@ -82,7 +82,7 @@ mod receiving_an_announce_request {
AnnounceEvent, AnnounceRequest, ConnectionId, InfoHash, NumberOfBytes, NumberOfPeers, PeerId, PeerKey, Port,
TransactionId,
};
use torrust_tracker::shared::bit_torrent::udp::client::new_udp_tracker_client_connected;
use torrust_tracker::shared::bit_torrent::tracker::udp::client::new_udp_tracker_client_connected;
use torrust_tracker_test_helpers::configuration;

use crate::servers::udp::asserts::is_ipv4_announce_response;
Expand Down Expand Up @@ -124,7 +124,7 @@ mod receiving_an_announce_request {

mod receiving_an_scrape_request {
use aquatic_udp_protocol::{ConnectionId, InfoHash, ScrapeRequest, TransactionId};
use torrust_tracker::shared::bit_torrent::udp::client::new_udp_tracker_client_connected;
use torrust_tracker::shared::bit_torrent::tracker::udp::client::new_udp_tracker_client_connected;
use torrust_tracker_test_helpers::configuration;

use crate::servers::udp::asserts::is_scrape_response;
Expand Down

0 comments on commit 129fd2f

Please sign in to comment.