Skip to content

Commit

Permalink
router: log errors while reading mmdb files (eycorsican#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdbai authored May 15, 2021
1 parent 9afcc27 commit 8c7e442
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions leaf/src/app/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,16 +380,17 @@ impl Router {
for mmdb in rr.mmdbs.iter() {
let reader = match mmdb_readers.get(&mmdb.file) {
Some(r) => r.clone(),
None => {
if let Ok(r) = maxminddb::Reader::open_mmap(&mmdb.file) {
None => match maxminddb::Reader::open_mmap(&mmdb.file) {
Ok(r) => {
let r = Arc::new(r);
mmdb_readers.insert((&mmdb.file).to_owned(), r.clone());
r
} else {
warn!("open mmdb file {} failed", mmdb.file);
}
Err(e) => {
warn!("open mmdb file {} failed: {:?}", mmdb.file, e);
continue;
}
}
},
};
cond_and.add(Box::new(MmdbMatcher::new(
reader,
Expand Down

0 comments on commit 8c7e442

Please sign in to comment.