File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -293,8 +293,8 @@ pub fn send_payload(
293293 } ;
294294
295295 if let Ok ( _) = send_res {
296+ last_seen. store ( Stats :: dur_ns ( t_start, t_recv) , AtomOrdering :: Relaxed ) ;
296297 let t_send = Instant :: now ( ) ;
297- last_seen. store ( Stats :: dur_ns ( t_start, t_send) , AtomOrdering :: Relaxed ) ;
298298 stats. send_add ( c2u, len as u64 , t_recv, t_send) ;
299299 } else if sock_connected && is_dest_addr_required ( & send_res) {
300300 dest_addr_okay = false ;
@@ -309,8 +309,8 @@ pub fn send_payload(
309309
310310 match retry_res {
311311 Ok ( _) => {
312+ last_seen. store ( Stats :: dur_ns ( t_start, t_recv) , AtomOrdering :: Relaxed ) ;
312313 let t_send = Instant :: now ( ) ;
313- last_seen. store ( Stats :: dur_ns ( t_start, t_send) , AtomOrdering :: Relaxed ) ;
314314 stats. send_add ( c2u, len as u64 , t_recv, t_send) ;
315315 }
316316 Err ( e) => {
Original file line number Diff line number Diff line change @@ -161,8 +161,8 @@ pub fn run_watchdog_thread(
161161 let now = Instant :: now ( ) ;
162162 let now_ns = Stats :: dur_ns ( t_start, now) ;
163163 let last_ns = last_seen_ns. load ( AtomOrdering :: Relaxed ) ;
164- let expired = last_ns != 0 && now_ns . saturating_sub ( last_ns ) >= timeout_ns ;
165- if expired {
164+
165+ if last_ns != 0 && now_ns . saturating_sub ( last_ns ) >= timeout_ns {
166166 match cfg. on_timeout {
167167 TimeoutAction :: Drop => {
168168 log_warn ! (
@@ -325,6 +325,7 @@ pub fn run_client_to_upstream_thread(
325325 match handles. client_sock . recv ( as_uninit_mut ( & mut buf. data ) ) {
326326 Ok ( len) => {
327327 let t_recv = Instant :: now ( ) ;
328+
328329 if locked. load ( AtomOrdering :: Relaxed ) {
329330 send_payload (
330331 C2U ,
@@ -358,6 +359,7 @@ pub fn run_client_to_upstream_thread(
358359 match handles. client_sock . recv_from ( as_uninit_mut ( & mut buf. data ) ) {
359360 Ok ( ( len, src_sa) ) => {
360361 let t_recv = Instant :: now ( ) ;
362+
361363 // First lock: publish client and connect the socket for fast path
362364 if !locked. load ( AtomOrdering :: Relaxed ) {
363365 let Some ( src) = src_sa. as_socket ( ) else {
You can’t perform that action at this time.
0 commit comments