|
a/src/internfile/mh_mbox.cpp |
|
b/src/internfile/mh_mbox.cpp |
|
... |
|
... |
78 |
}
|
78 |
}
|
79 |
|
79 |
|
80 |
~MboxCache() {}
|
80 |
~MboxCache() {}
|
81 |
mbhoff_type get_offset(RclConfig *config, const string& udi, int msgnum)
|
81 |
mbhoff_type get_offset(RclConfig *config, const string& udi, int msgnum)
|
82 |
{
|
82 |
{
|
83 |
PTMutexLocker locker(o_mutex);
|
|
|
84 |
LOGDEB0(("MboxCache::get_offsets: udi [%s] msgnum %d\n", udi.c_str(),
|
83 |
LOGDEB0(("MboxCache::get_offsets: udi [%s] msgnum %d\n", udi.c_str(),
|
85 |
msgnum));
|
84 |
msgnum));
|
86 |
if (!ok(config)) {
|
85 |
if (!ok(config)) {
|
87 |
LOGDEB0(("MboxCache::get_offsets: init failed\n"));
|
86 |
LOGDEB0(("MboxCache::get_offsets: init failed\n"));
|
88 |
return -1;
|
87 |
return -1;
|
89 |
}
|
88 |
}
|
|
|
89 |
PTMutexLocker locker(o_mutex);
|
90 |
string fn = makefilename(udi);
|
90 |
string fn = makefilename(udi);
|
91 |
FILE *fp = 0;
|
91 |
FILE *fp = 0;
|
92 |
if ((fp = fopen(fn.c_str(), "r")) == 0) {
|
92 |
if ((fp = fopen(fn.c_str(), "r")) == 0) {
|
93 |
LOGDEB(("MboxCache::get_offsets: open failed, errno %d\n", errno));
|
93 |
LOGDEB(("MboxCache::get_offsets: open failed, errno %d\n", errno));
|
94 |
return -1;
|
94 |
return -1;
|
|
... |
|
... |
126 |
|
126 |
|
127 |
// Save array of offsets for a given file, designated by Udi
|
127 |
// Save array of offsets for a given file, designated by Udi
|
128 |
void put_offsets(RclConfig *config, const string& udi, mbhoff_type fsize,
|
128 |
void put_offsets(RclConfig *config, const string& udi, mbhoff_type fsize,
|
129 |
vector<mbhoff_type>& offs)
|
129 |
vector<mbhoff_type>& offs)
|
130 |
{
|
130 |
{
|
131 |
PTMutexLocker locker(o_mutex);
|
|
|
132 |
LOGDEB0(("MboxCache::put_offsets: %u offsets\n", offs.size()));
|
131 |
LOGDEB0(("MboxCache::put_offsets: %u offsets\n", offs.size()));
|
133 |
if (!ok(config) || !maybemakedir())
|
132 |
if (!ok(config) || !maybemakedir())
|
134 |
return;
|
133 |
return;
|
135 |
if (fsize < m_minfsize)
|
134 |
if (fsize < m_minfsize)
|
136 |
return;
|
135 |
return;
|
|
|
136 |
PTMutexLocker locker(o_mutex);
|
137 |
string fn = makefilename(udi);
|
137 |
string fn = makefilename(udi);
|
138 |
FILE *fp;
|
138 |
FILE *fp;
|
139 |
if ((fp = fopen(fn.c_str(), "w")) == 0) {
|
139 |
if ((fp = fopen(fn.c_str(), "w")) == 0) {
|
140 |
LOGDEB(("MboxCache::put_offsets: fopen errno %d\n", errno));
|
140 |
LOGDEB(("MboxCache::put_offsets: fopen errno %d\n", errno));
|
141 |
return;
|
141 |
return;
|