Skip to content

Commit

Permalink
refactor: rename function
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed Aug 12, 2022
1 parent 6c2f312 commit bfa803b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/protocol/clock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl Clock for SystemClock {
}

/// It returns the current timestamp using the system clock.
pub fn current_timestamp_from_system_clock() -> u64 {
pub fn current_timestamp() -> u64 {
let system_clock = SystemClock;
system_clock.now_as_timestamp()
}
4 changes: 2 additions & 2 deletions src/udp/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::udp::request::AnnounceRequestWrapper;
use crate::tracker::statistics::TrackerStatisticsEvent;
use crate::tracker::tracker::TorrentTracker;
use crate::protocol::utils::get_connection_id;
use crate::protocol::clock::current_timestamp_from_system_clock;
use crate::protocol::clock::current_timestamp;

pub async fn authenticate(info_hash: &InfoHash, tracker: Arc<TorrentTracker>) -> Result<(), ServerError> {
match tracker.authenticate_request(info_hash, &None).await {
Expand Down Expand Up @@ -71,7 +71,7 @@ pub async fn handle_request(request: Request, remote_addr: SocketAddr, tracker:
}

pub async fn handle_connect(remote_addr: SocketAddr, request: &ConnectRequest, tracker: Arc<TorrentTracker>) -> Result<Response, ServerError> {
let connection_id = get_connection_id(&remote_addr, current_timestamp_from_system_clock());
let connection_id = get_connection_id(&remote_addr, current_timestamp());

let response = Response::from(ConnectResponse {
transaction_id: request.transaction_id,
Expand Down

0 comments on commit bfa803b

Please sign in to comment.