forked from torrust/torrust-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod.rs
More file actions
40 lines (36 loc) · 1.36 KB
/
Copy pathmod.rs
File metadata and controls
40 lines (36 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
mod error;
mod request_aborted;
mod request_accepted;
mod request_banned;
mod request_received;
mod response_sent;
use torrust_clock::DurationSinceUnixEpoch;
use crate::event::Event;
use crate::statistics::repository::Repository;
pub async fn handle_event(event: Event, stats_repository: &Repository, now: DurationSinceUnixEpoch) {
match event {
Event::UdpRequestAborted { context } => {
request_aborted::handle_event(context, stats_repository, now).await;
}
Event::UdpRequestBanned { context } => {
request_banned::handle_event(context, stats_repository, now).await;
}
Event::UdpRequestReceived { context } => {
request_received::handle_event(context, stats_repository, now).await;
}
Event::UdpRequestAccepted { context, kind } => {
request_accepted::handle_event(context, kind, stats_repository, now).await;
}
Event::UdpResponseSent {
context,
kind,
req_processing_time,
} => {
response_sent::handle_event(context, kind, req_processing_time, stats_repository, now).await;
}
Event::UdpError { context, kind, error } => {
error::handle_event(context, kind, error, stats_repository, now).await;
}
}
tracing::debug!("stats: {:?}", stats_repository.get_stats().await);
}