Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT PANIC! #59

Closed
Luap99 opened this issue Feb 3, 2022 · 1 comment · Fixed by #76
Closed

DO NOT PANIC! #59

Luap99 opened this issue Feb 3, 2022 · 1 comment · Fixed by #76

Comments

@Luap99
Copy link
Member

Luap99 commented Feb 3, 2022

There are way to many uses of .unwrap() here:

$ grep -R "unwrap()" src/
src/backend/mod.rs:            if name.len() > 0 && name.chars().last().unwrap() == '.' {
src/config/mod.rs:                if cfg.path().file_name().unwrap() == constants::AARDVARK_PID_FILE {
src/config/mod.rs:                        new_ctr_ips.push(IpAddr::V4(entry.v4.unwrap()));
src/config/mod.rs:                        new_ctr_ips.push(IpAddr::V6(entry.v6.unwrap()));
src/dns/coredns.rs:        let name: Name = Name::parse(name, None).unwrap();
src/dns/coredns.rs:        let origin: Name = Name::from_str_relaxed(name).unwrap();
src/dns/coredns.rs:                    match v.unwrap() {
src/dns/coredns.rs:                            let (name, record_type, mut req) = parse_dns_msg(msg).unwrap();
src/dns/coredns.rs:                                self.kill_switch.lock().unwrap()
src/dns/coredns.rs:                                                    request_name = request_name.strip_suffix(&self.filter_search_domain).unwrap().to_string();
src/dns/coredns.rs:                                                    request_name = request_name.strip_suffix(&filter_domain_ndots_complete).unwrap().to_string();
src/dns/coredns.rs:                            let record_name: Name = Name::from_str_relaxed(name.as_str()).unwrap();
src/dns/coredns.rs:                                    reply(sender.clone(), src_address, &nx_message).unwrap();
src/dns/coredns.rs:                                            let record_name: Name = Name::from_str_relaxed(name.as_str()).unwrap();
src/server/serve.rs:                let mut switch = kill_switch.lock().unwrap();
src/server/serve.rs:                let _ = handle.join().unwrap();
src/server/serve.rs:    tx.broadcast(true).await.unwrap();
src/server/serve.rs:    let address = address_string.parse().unwrap();
src/server/serve.rs:    let conn = UdpClientConnection::with_timeout(address, Duration::from_millis(5)).unwrap();
src/server/serve.rs:    let name = Name::from_str("anything.").unwrap();

We should always log a useful error and only exit when absolutely necessary. Aardvark is a daemon we should never die because of a small error.

@flouthoc
Copy link
Collaborator

@Luap99 Above PR should close this issue.

@flouthoc flouthoc linked a pull request Feb 16, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants