diff --git a/net/utils.cpp b/net/utils.cpp index ed514ed9..010678f3 100644 --- a/net/utils.cpp +++ b/net/utils.cpp @@ -304,8 +304,10 @@ class DefaultResolver : public Resolver { void discard_cache(const char *host, IPAddr ip) override { auto ipaddr = dnscache_.borrow(host); - if (ip.undefined() || ipaddr->empty()) ipaddr.recycle(true); - else { + if (ip.undefined() || ipaddr->empty()) { + ipaddr->delete_all(); + ipaddr.recycle(true); + } else { for (auto itr = ipaddr->rbegin(); itr != ipaddr->rend(); itr++) { if ((*itr)->addr == ip) { ipaddr->erase(*itr);