Repository navigation
Enrich UDP core Event::UdpAnnounce event - #1473
josecelano merged 5 commits into
Conversation
…::UdpAnnounce Added: - info-hash - peer announcement info Following the same chage as in the HTTP tracker core.
In order to be able to compare full events.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1473 +/- ##
===========================================
+ Coverage 84.50% 84.55% +0.04%
===========================================
Files 255 257 +2
Lines 19437 19510 +73
Branches 19437 19510 +73
===========================================
+ Hits 16426 16496 +70
- Misses 2726 2727 +1
- Partials 285 287 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
d741707 to
e9ec15a
Compare
|
ACK e9ec15a |
da2ce7
left a comment
There was a problem hiding this comment.
Post-merge review of the change from #1473 as it stands at e170b9620 on the default branch.
What still runs: Event::UdpAnnounce (packages/udp-core/src/event.rs:31-35) carries connection, info_hash and announcement, and AnnounceService::send_event (packages/udp-core/src/services/announce.rs:163-182) fills them with the request's info hash and the peer as it stands after handle_announcement, so announcement.peer_addr is the resolved address (the configured external IP for a loopback client) while connection keeps the client socket address. The connection field name on all three variants, the debug lines in the announce and scrape services, sample_info_hash (packages/udp-core/src/lib.rs:41-54) and the sample_peer and announce_events_match test helpers (packages/udp-server/src/lib.rs:679-731) are live. The unconditional println! of every announce event that this change added to the announce service was removed in 57b4822. No production consumer reads the two new fields yet: the statistics handler and listener match UdpAnnounce { connection, .. }.
[Minor] packages/udp-core/src/services/announce.rs:178 and packages/udp-core/src/services/scrape.rs:140 call tracing::debug!(target = crate::UDP_TRACKER_LOG_TARGET, ...). In tracing 0.1 a record's target is set with target:; target = ... declares an ordinary field that happens to be named target. Both records therefore keep the module path (torrust_tracker_udp_core::services::announce, ...::scrape) as their target and carry an extra field target="UDP TRACKER", unlike the crate's other targeted log lines, which use target: UDP_TRACKER_LOG_TARGET (for example packages/udp-core/src/statistics/event/listener.rs:48). With the threshold at debug, anything that selects lines by the UDP TRACKER target, including the top-level target key of the JSON style, misses every announce and scrape event line. Fix: replace target = with target: on both lines.
[Nit] packages/udp-server/src/lib.rs:719-720: the comment explaining why announce_events_match skips a field says "announcement.uploaded contains the current time", but the skipped field is updated (line 722) and uploaded is compared on line 723. In this crate's tests updated comes from the working clock of the udp-core dependency (packages/udp-core/src/peer_builder.rs:36), so the partial comparison is still needed; only the field name in the comment is wrong. Fix: name announcement.updated in the comment.
Checked and found sound: the tree of merge 0485a86 equals head e9ec15a; the enum and the event construction match the description; the event is published only after a successful announce; the .. patterns in packages/udp-core/src/statistics/event/handler.rs:29 and packages/udp-core/src/statistics/event/listener.rs:153 leave the metrics unchanged; sample_peer agrees with the request builder's defaults, so the_peer_ip_should_be_changed_to_the_external_ip_in_the_tracker_configuration checks the external address in the event; the core test at packages/udp-core/src/services/announce.rs:654 compares the whole event under the stopped clock; the new debug lines log, in parsed form, the client address, info hash and peer id that the request debug line at packages/udp-server/src/handlers/mod.rs:92 already logs at the same level; the changed code adds no panic on request input.
Enrich UDP core
Event::UdpAnnounceevent.