@@ -2,6 +2,7 @@ use crate::auth::validate_token_format;
22use crate :: stream:: { Multiplexer , PrioritizedFrame , VirtualStream } ;
33use crate :: transport:: batched_sender:: run_batched_sender;
44use crate :: transport:: { self , TransportConfig } ;
5+ use crate :: tunnel:: common:: clamp_u128_to_u64;
56use ferrotunnel_common:: { Result , TunnelError } ;
67use ferrotunnel_protocol:: codec:: TunnelCodec ;
78use ferrotunnel_protocol:: constants:: { MAX_PROTOCOL_VERSION , MIN_PROTOCOL_VERSION } ;
@@ -163,7 +164,6 @@ impl TunnelClient {
163164 where
164165 C : FnOnce ( Uuid ) + Send + ' static ,
165166 {
166- #[ allow( clippy:: cast_possible_truncation) ]
167167 framed
168168 . send ( Frame :: Handshake ( Box :: new ( HandshakeFrame {
169169 min_version : MIN_PROTOCOL_VERSION ,
@@ -258,11 +258,12 @@ impl TunnelClient {
258258 let decode_start = Instant :: now ( ) ;
259259 tokio:: select! {
260260 _ = heartbeat_interval. tick( ) => {
261- # [ allow ( clippy :: cast_possible_truncation ) ]
262- let ts = std:: time:: SystemTime :: now( )
261+ let ts = clamp_u128_to_u64 (
262+ std:: time:: SystemTime :: now( )
263263 . duration_since( std:: time:: UNIX_EPOCH )
264264 . unwrap_or_default( )
265- . as_millis( ) as u64 ;
265+ . as_millis( )
266+ ) ;
266267 if let Err ( e) = multiplexer. send_frame( Frame :: Heartbeat { timestamp: ts } ) . await {
267268 error!( "Failed to send heartbeat: {}" , e) ;
268269 return Err ( e) ;
0 commit comments