@@ -15,7 +15,7 @@ use rsip::{prelude::HeadersExt, SipMessage};
1515use std:: {
1616 collections:: HashMap ,
1717 sync:: { Arc , Mutex , RwLock } ,
18- time:: { Duration , Instant } ,
18+ time:: Duration ,
1919} ;
2020use tokio:: {
2121 select,
@@ -108,6 +108,7 @@ pub struct EndpointInner {
108108 incoming_sender : TransactionSender ,
109109 incoming_receiver : Mutex < Option < TransactionReceiver > > ,
110110 cancel_token : CancellationToken ,
111+ #[ allow( dead_code) ]
111112 timer_interval : Duration ,
112113 pub ( super ) message_inspector : Option < Box < dyn MessageInspector > > ,
113114 pub ( super ) locator : Option < Box < dyn TargetLocator > > ,
@@ -235,13 +236,10 @@ impl EndpointInner {
235236
236237 pub async fn serve ( self : & Arc < Self > ) -> Result < ( ) > {
237238 select ! {
238- _ = self . cancel_token. cancelled( ) => {
239- } ,
240- r = self . process_timer( ) => {
241- _ = r?
242- } ,
239+ _ = self . cancel_token. cancelled( ) => { } ,
240+ _ = self . process_timer( ) => { } ,
243241 r = self . clone( ) . process_transport_layer( ) => {
244- _ = r?
242+ _ = r?;
245243 } ,
246244 }
247245 Ok ( ( ) )
@@ -290,10 +288,9 @@ impl EndpointInner {
290288 Ok ( ( ) )
291289 }
292290
293- pub async fn process_timer ( & self ) -> Result < ( ) > {
294- let mut ticker = tokio:: time:: interval ( self . timer_interval ) ;
291+ pub async fn process_timer ( & self ) {
295292 loop {
296- for t in self . timers . poll ( Instant :: now ( ) ) {
293+ for t in self . timers . wait_for_ready ( ) . await . into_iter ( ) {
297294 match t {
298295 TransactionTimer :: TimerCleanup ( key) => {
299296 trace ! ( %key, "TimerCleanup" ) ;
@@ -326,7 +323,6 @@ impl EndpointInner {
326323 }
327324 }
328325 }
329- ticker. tick ( ) . await ;
330326 }
331327 }
332328
0 commit comments