rt monitor: make a copy of the config in the 2nd thread to avoid concurrent accesses (no reported bug on this, but could lead to a crash)
This commit is contained in:
parent
c03f4661f8
commit
5ac07b20f6
@ -128,8 +128,13 @@ void *rclMonRcvRun(void *q)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make a local copy of the configuration as it doesn't like
|
||||||
|
// concurrent accesses. It's ok to copy it here as the other
|
||||||
|
// thread will not work before we have sent events.
|
||||||
|
RclConfig lconfig(*queue->getConfig());
|
||||||
|
|
||||||
// Get top directories from config
|
// Get top directories from config
|
||||||
list<string> tdl = queue->getConfig()->getTopdirs();
|
list<string> tdl = lconfig.getTopdirs();
|
||||||
if (tdl.empty()) {
|
if (tdl.empty()) {
|
||||||
LOGERR(("rclMonRcvRun:: top directory list (topdirs param.) not"
|
LOGERR(("rclMonRcvRun:: top directory list (topdirs param.) not"
|
||||||
"found in config or Directory list parse error"));
|
"found in config or Directory list parse error"));
|
||||||
@ -139,13 +144,13 @@ void *rclMonRcvRun(void *q)
|
|||||||
|
|
||||||
// Walk the directory trees to add watches
|
// Walk the directory trees to add watches
|
||||||
FsTreeWalker walker;
|
FsTreeWalker walker;
|
||||||
walker.setSkippedPaths(queue->getConfig()->getDaemSkippedPaths());
|
walker.setSkippedPaths(lconfig.getDaemSkippedPaths());
|
||||||
WalkCB walkcb(queue->getConfig(), mon, queue, walker);
|
WalkCB walkcb(&lconfig, mon, queue, walker);
|
||||||
for (list<string>::iterator it = tdl.begin(); it != tdl.end(); it++) {
|
for (list<string>::iterator it = tdl.begin(); it != tdl.end(); it++) {
|
||||||
queue->getConfig()->setKeyDir(*it);
|
lconfig.setKeyDir(*it);
|
||||||
// Adjust the follow symlinks options
|
// Adjust the follow symlinks options
|
||||||
bool follow;
|
bool follow;
|
||||||
if (queue->getConfig()->getConfParam("followLinks", &follow) &&
|
if (lconfig.getConfParam("followLinks", &follow) &&
|
||||||
follow) {
|
follow) {
|
||||||
walker.setOpts(FsTreeWalker::FtwFollow);
|
walker.setOpts(FsTreeWalker::FtwFollow);
|
||||||
} else {
|
} else {
|
||||||
@ -156,10 +161,10 @@ void *rclMonRcvRun(void *q)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool dobeagle = false;
|
bool dobeagle = false;
|
||||||
queue->getConfig()->getConfParam("processbeaglequeue", &dobeagle);
|
lconfig.getConfParam("processbeaglequeue", &dobeagle);
|
||||||
if (dobeagle) {
|
if (dobeagle) {
|
||||||
string beaglequeuedir;
|
string beaglequeuedir;
|
||||||
if (!queue->getConfig()->getConfParam("beaglequeuedir", beaglequeuedir))
|
if (!lconfig.getConfParam("beaglequeuedir", beaglequeuedir))
|
||||||
beaglequeuedir = path_tildexpand("~/.beagle/ToIndex/");
|
beaglequeuedir = path_tildexpand("~/.beagle/ToIndex/");
|
||||||
mon->addWatch(beaglequeuedir, true);
|
mon->addWatch(beaglequeuedir, true);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user