@@ -22,13 +22,13 @@ pub async fn handle_error(
2222 opt_udp_server_stats_event_sender : & crate :: event:: sender:: Sender ,
2323 cookie_valid_range : Range < f64 > ,
2424 error : & Error ,
25- transaction_id : Option < TransactionId > ,
25+ opt_transaction_id : Option < TransactionId > ,
2626) -> Response {
2727 tracing:: trace!( "handle error" ) ;
2828
2929 let server_socket_addr = server_service_binding. bind_address ( ) ;
3030
31- match transaction_id {
31+ match opt_transaction_id {
3232 Some ( transaction_id) => {
3333 let transaction_id = transaction_id. 0 . to_string ( ) ;
3434 tracing:: error!( target: UDP_TRACKER_LOG_TARGET , error = %error, %client_socket_addr, %server_socket_addr, %request_id, %transaction_id, "response error" ) ;
@@ -38,13 +38,7 @@ pub async fn handle_error(
3838 }
3939 }
4040
41- let e = if let Error :: RequestParseError { request_parse_error } = error {
42- ( request_parse_error. message . clone ( ) , transaction_id)
43- } else {
44- ( error. to_string ( ) , transaction_id)
45- } ;
46-
47- if e. 1 . is_some ( ) {
41+ if opt_transaction_id. is_some ( ) {
4842 // code-review: why we trigger an event only if transaction_id is present?
4943
5044 if let Some ( udp_server_stats_event_sender) = opt_udp_server_stats_event_sender. as_deref ( ) {
@@ -59,7 +53,7 @@ pub async fn handle_error(
5953 }
6054
6155 Response :: from ( ErrorResponse {
62- transaction_id : e . 1 . unwrap_or ( TransactionId ( I32 :: new ( 0 ) ) ) ,
63- message : e . 0 . into ( ) ,
56+ transaction_id : opt_transaction_id . unwrap_or ( TransactionId ( I32 :: new ( 0 ) ) ) ,
57+ message : error . to_string ( ) . into ( ) ,
6458 } )
6559}
0 commit comments