@@ -14,6 +14,7 @@ use mqtt_channel::StreamExt;
1414use mqtt_channel:: SubscriberOps ;
1515pub use mqtt_channel:: Topic ;
1616pub use mqtt_channel:: TopicFilter ;
17+ use std:: collections:: HashSet ;
1718use std:: convert:: Infallible ;
1819use std:: sync:: Arc ;
1920use std:: time:: Duration ;
@@ -356,10 +357,10 @@ impl TrieService {
356357}
357358
358359#[ cfg( feature = "test-helpers" ) ]
359- #[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
360+ #[ derive( Debug , Clone , Copy , Hash , PartialEq , Eq ) ]
360361pub struct ClientId ( pub usize ) ;
361362#[ cfg( not( feature = "test-helpers" ) ) ]
362- #[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
363+ #[ derive( Debug , Clone , Copy , Hash , PartialEq , Eq ) ]
363364pub struct ClientId ( usize ) ;
364365
365366type MatchRequest = String ;
@@ -627,7 +628,7 @@ impl ToPeers {
627628 let TrieResponse :: Matched ( matches) = subscribed else {
628629 unreachable ! ( "MatchRequest always returns Matched" )
629630 } ;
630- for client in matches {
631+ for client in HashSet :: < ClientId > :: from_iter ( matches) {
631632 self . sender_by_id ( client) . send ( message. clone ( ) ) . await ?;
632633 }
633634 Ok ( ( ) )
0 commit comments