}
+static uint64_t dumpNegCache(SyncRes::negcache_t& negcache, int fd)
+{
+ FILE* fp=fdopen(dup(fd), "w");
+ if(!fp) { // dup probably failed
+ return 0;
+ }
+ fprintf(fp, "; negcache dump from thread follows\n;\n");
+ time_t now = time(0);
+
+ typedef SyncRes::negcache_t::nth_index<1>::type sequence_t;
+ sequence_t& sidx=negcache.get<1>();
+
+ uint64_t count=0;
+ BOOST_FOREACH(const NegCacheEntry& neg, sidx)
+ {
+ ++count;
+ fprintf(fp, "%s IN %s %d VIA %s\n", neg.d_name.c_str(), neg.d_qtype.getName().c_str(), (unsigned int) (neg.d_ttd - now), neg.d_qname.c_str());
+ }
+ fclose(fp);
+ return count;
+}
+
static uint64_t* pleaseDump(int fd)
{
- return new uint64_t(t_RC->doDump(fd));
+ return new uint64_t(t_RC->doDump(fd) + dumpNegCache(t_sstorage->negcache, fd));
}
template<typename T>
if(!fp) { // dup probably failed
return 0;
}
- fprintf(fp, "; dump from thread follows\n;\n");
+ fprintf(fp, "; main record cache dump from thread follows\n;\n");
typedef cache_t::nth_index<1>::type sequence_t;
sequence_t& sidx=d_cache.get<1>();