@@ -217,8 +217,8 @@ impl CacheByDomainName {
217
217
}
218
218
219
219
/// For each domain name, it removes the RRStoredData past its TTL.
220
- pub fn filter_timeout_host_data ( & mut self ) {
221
- let mut new_hash = HashMap :: < DomainName , Vec < RRStoredData > > :: new ( ) ;
220
+ pub fn filter_timeout_by_domain_name ( & mut self ) {
221
+ let mut new_hash: HashMap < DomainName , Vec < RRStoredData > > = HashMap :: < DomainName , Vec < RRStoredData > > :: new ( ) ;
222
222
let data = self . get_domain_names_data ( ) ;
223
223
let current_time = Utc :: now ( ) ;
224
224
for ( domain_name, rr_cache_vec) in data. into_iter ( ) {
@@ -518,7 +518,7 @@ mod host_data_test{
518
518
thread:: sleep ( time:: Duration :: from_secs ( 5 ) ) ;
519
519
println ! ( "After timeout: {:?}" , Utc :: now( ) ) ;
520
520
//clean the data with expired ttl
521
- cache_by_domain_name. filter_timeout_host_data ( ) ;
521
+ cache_by_domain_name. filter_timeout_by_domain_name ( ) ;
522
522
523
523
assert_eq ! ( cache_by_domain_name. get_domain_names_data( ) . len( ) , 1 ) ;
524
524
if let Some ( rr_cache_vec) = cache_by_domain_name. get_domain_names_data ( ) . get ( & domain_name) {
@@ -533,7 +533,7 @@ mod host_data_test{
533
533
534
534
#[ test]
535
535
fn timeout_rr_cache_two_domain ( ) {
536
- //this test prove the for iteration in filter_timeout_host_data
536
+ //this test prove the for iteration in filter_timeout_by_domain_name
537
537
use std:: { thread, time} ;
538
538
let mut cache_by_domain_name = CacheByDomainName :: new ( ) ;
539
539
let a_rdata = Rdata :: A ( ARdata :: new ( ) ) ;
@@ -567,7 +567,7 @@ mod host_data_test{
567
567
thread:: sleep ( time:: Duration :: from_secs ( 5 ) ) ;
568
568
println ! ( "After timeout: {:?}" , Utc :: now( ) ) ;
569
569
//clean the data with expired ttl
570
- cache_by_domain_name. filter_timeout_host_data ( ) ;
570
+ cache_by_domain_name. filter_timeout_by_domain_name ( ) ;
571
571
572
572
println ! ( "The new cache is {:?} " , cache_by_domain_name. get_domain_names_data( ) ) ;
573
573
0 commit comments