Closed hannesm closed 2 years ago
Wouldn't it make more sense to just look at mtime on /etc/resolv.conf instead of constantly calculating digests ? Or did I miss something ?
Wouldn't it make more sense to just look at mtime on /etc/resolv.conf instead of constantly calculating digests ? Or did I miss something ?
@haesbaert we discussed this on IRC and most of it is summarized in #296. Note that the lwt implementation will reuse the connection if possible and "only" re-read resolv.conf when reconnecting.
Wouldn't it make more sense to just look at mtime on /etc/resolv.conf instead of constantly calculating digests ? Or did I miss something ?
@haesbaert we discussed this on IRC and most of it is summarized in #296. Note that the lwt implementation will reuse the connection if possible and "only" re-read resolv.conf when reconnecting.
Ack, sorry for the noise :D
I made a pull request to this pull request https://github.com/hannesm/ocaml-dns/pull/1 where I implement the behavior I mentioned earlier.
Only affects lwt and unix. Previously, when you started an application, /etc/resolv.conf was read once at startup. When you switch to a different network, and /etc/resolv.conf is updated by DHCP, this is not reflected in the dns-client.
Now, the digest of /etc/resolv.conf is stored internally, and if it changes, it is parsed again. The lwt implementation needed to be modified slightly since connect_to_ns_via_tcp carried a nameserver list, and a different task may have been woken up. Now, there are two functions and it should play out nicely.
//cc @reynir addresses #243