|
a/src/ohmetacache.cxx |
|
b/src/ohmetacache.cxx |
|
... |
|
... |
18 |
#include "ohmetacache.hxx"
|
18 |
#include "ohmetacache.hxx"
|
19 |
|
19 |
|
20 |
#include <errno.h> // for errno
|
20 |
#include <errno.h> // for errno
|
21 |
#include <stdio.h> // for rename
|
21 |
#include <stdio.h> // for rename
|
22 |
#include <string.h> // for strchr
|
22 |
#include <string.h> // for strchr
|
|
|
23 |
#include <unistd.h>
|
23 |
|
24 |
|
24 |
#include <iostream> // for basic_ostream, operator<<, etc
|
25 |
#include <iostream> // for basic_ostream, operator<<, etc
|
25 |
#include <utility> // for pair
|
26 |
#include <utility> // for pair
|
26 |
|
27 |
|
27 |
#include "libupnpp/log.hxx" // for LOGERR, LOGDEB
|
28 |
#include "libupnpp/log.hxx" // for LOGERR, LOGDEB
|
28 |
#include "workqueue.hxx" // for WorkQueue
|
29 |
#include "workqueue.hxx" // for WorkQueue
|
29 |
|
30 |
|
30 |
using namespace std;
|
31 |
using namespace std;
|
31 |
using namespace UPnPP;
|
32 |
using namespace UPnPP;
|
|
|
33 |
|
|
|
34 |
static unsigned int slptimesecs;
|
|
|
35 |
void dmcacheSetOpts(unsigned int slpsecs)
|
|
|
36 |
{
|
|
|
37 |
slptimesecs = slpsecs;
|
|
|
38 |
}
|
32 |
|
39 |
|
33 |
class SaveCacheTask {
|
40 |
class SaveCacheTask {
|
34 |
public:
|
41 |
public:
|
35 |
SaveCacheTask(const string& fn, const mcache_type& cache)
|
42 |
SaveCacheTask(const string& fn, const mcache_type& cache)
|
36 |
: m_fn(fn), m_cache(cache)
|
43 |
: m_fn(fn), m_cache(cache)
|
|
... |
|
... |
147 |
LOGERR("dmcacheSave: rename(" << tfn << ", " << tsk->m_fn << ")" <<
|
154 |
LOGERR("dmcacheSave: rename(" << tfn << ", " << tsk->m_fn << ")" <<
|
148 |
" failed: errno: " << errno << endl);
|
155 |
" failed: errno: " << errno << endl);
|
149 |
}
|
156 |
}
|
150 |
|
157 |
|
151 |
delete tsk;
|
158 |
delete tsk;
|
|
|
159 |
if (slptimesecs) {
|
|
|
160 |
LOGDEB1("dmcacheSave: sleeping " << slptimesecs << endl);
|
|
|
161 |
sleep(slptimesecs);
|
|
|
162 |
}
|
152 |
}
|
163 |
}
|
153 |
}
|
164 |
}
|
154 |
|
165 |
|
155 |
// Max size of metadata element ??
|
166 |
// Max size of metadata element ??
|
156 |
#define LL 10*1024
|
167 |
#define LL 10*1024
|