File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -374,7 +374,7 @@ impl Service {
374374 continue ;
375375 } ;
376376 assert_eq ! ( new_owner, "" ) ; // We enforce that in the matching rule
377- if let Some ( session) = self . session_from_sender ( old_owner. as_ref ( ) ) . await {
377+ if let Some ( session) = self . session_from_sender ( & old_owner) . await {
378378 match session. close ( ) . await {
379379 Ok ( _) => tracing:: info!(
380380 "Client {} disconnected. Session: {} closed." ,
@@ -467,16 +467,10 @@ impl Service {
467467 n_sessions
468468 }
469469
470- async fn session_from_sender ( & self , sender : UniqueName < ' _ > ) -> Option < Session > {
470+ async fn session_from_sender ( & self , sender : & UniqueName < ' _ > ) -> Option < Session > {
471471 let sessions = self . sessions . lock ( ) . await ;
472472
473- for session in sessions. values ( ) {
474- if session. sender ( ) == & sender {
475- return Some ( session. clone ( ) ) ;
476- }
477- }
478-
479- None
473+ sessions. values ( ) . find ( |s| s. sender ( ) == sender) . cloned ( )
480474 }
481475
482476 pub async fn session ( & self , path : & ObjectPath < ' _ > ) -> Option < Session > {
You can’t perform that action at this time.
0 commit comments