From dd5cf808b514c6e4089202eb97f7ff2859f20747 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Mon, 23 Sep 2019 09:26:19 +0200 Subject: [PATCH] mbox: trim verbosity --- src/internfile/mh_mbox.cpp | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/src/internfile/mh_mbox.cpp b/src/internfile/mh_mbox.cpp index c14eb7ff..89eb9722 100644 --- a/src/internfile/mh_mbox.cpp +++ b/src/internfile/mh_mbox.cpp @@ -133,7 +133,8 @@ public: ~MboxCache() {} - int64_t get_offset(RclConfig *config, const string& udi, int msgnum) { + int64_t get_offset(RclConfig *config, const string& udi, int msgnum, + int64_t filesize) { LOGDEB0("MboxCache::get_offset: udi [" << udi << "] msgnum " << msgnum << "\n"); if (!ok(config)) { @@ -144,7 +145,11 @@ public: string fn = makefilename(udi); ifstream instream(fn.c_str(), std::ifstream::binary); if (!instream.good()) { - LOGSYSERR("MboxCache::get_offset", "open", fn); + if (filesize > m_minfsize) { + LOGSYSERR("MboxCache::get_offset", "open", fn); + } else { + LOGDEB("MboxCache::get_offset: no cache for " << fn << endl); + } return -1; } char blk1[M_o_b1size]; @@ -373,7 +378,8 @@ bool MimeHandlerMbox::Internal::tryUseCache(int mtarg) if (pthis->m_udi.empty()) { goto out; } - if ((off = o_mcache.get_offset(pthis->m_config, pthis->m_udi, mtarg)) < 0) { + if ((off = o_mcache.get_offset(pthis->m_config, pthis->m_udi, mtarg, + fsize)) < 0) { goto out; } instream.seekg(off); @@ -450,20 +456,20 @@ bool MimeHandlerMbox::next_document() if (!m->instream.good()) { ifstream::iostate st = m->instream.rdstate(); if (st & std::ifstream::eofbit) { - LOGDEB0("MimeHandlerMbox:next: eof\n"); + LOGDEB0("MimeHandlerMbox:next: eof at " << message_end << endl); + } else { + if (st & std::ifstream::failbit) { + LOGDEB0("MimeHandlerMbox:next: failbit\n"); + LOGSYSERR("MimeHandlerMbox:next:", "", ""); + } + if (st & std::ifstream::badbit) { + LOGDEB0("MimeHandlerMbox:next: badbit\n"); + LOGSYSERR("MimeHandlerMbox:next:", "", ""); + } + if (st & std::ifstream::goodbit) { + LOGDEB1("MimeHandlerMbox:next: good\n"); + } } - if (st & std::ifstream::failbit) { - LOGDEB0("MimeHandlerMbox:next: fail\n"); - LOGSYSERR("MimeHandlerMbox:next:", "", ""); - } - if (st & std::ifstream::badbit) { - LOGDEB0("MimeHandlerMbox:next: bad\n"); - LOGSYSERR("MimeHandlerMbox:next:", "", ""); - } - if (st & std::ifstream::goodbit) { - LOGDEB0("MimeHandlerMbox:next: good\n"); - } - LOGDEB0("MimeHandlerMbox:next: eof at " << message_end << endl); iseof = true; m->msgnum++; break;