|
a/src/index/rclmonprc.cpp |
|
b/src/index/rclmonprc.cpp |
|
... |
|
... |
41 |
#include "debuglog.h"
|
41 |
#include "debuglog.h"
|
42 |
#include "recollindex.h"
|
42 |
#include "recollindex.h"
|
43 |
#include "pathut.h"
|
43 |
#include "pathut.h"
|
44 |
#include "x11mon.h"
|
44 |
#include "x11mon.h"
|
45 |
#include "rclionice.h"
|
45 |
#include "rclionice.h"
|
|
|
46 |
#include "subtreelist.h"
|
46 |
|
47 |
|
47 |
typedef unsigned long mttcast;
|
48 |
typedef unsigned long mttcast;
|
48 |
|
49 |
|
49 |
static pthread_t rcv_thrid;
|
50 |
static pthread_t rcv_thrid;
|
50 |
|
51 |
|
|
... |
|
... |
480 |
for (;;) {
|
481 |
for (;;) {
|
481 |
// Retrieve event
|
482 |
// Retrieve event
|
482 |
RclMonEvent ev = rclEQ.pop();
|
483 |
RclMonEvent ev = rclEQ.pop();
|
483 |
if (ev.m_path.empty())
|
484 |
if (ev.m_path.empty())
|
484 |
break;
|
485 |
break;
|
485 |
switch (ev.m_etyp) {
|
486 |
switch (ev.evtype()) {
|
486 |
case RclMonEvent::RCLEVT_MODIFY:
|
487 |
case RclMonEvent::RCLEVT_MODIFY:
|
|
|
488 |
case RclMonEvent::RCLEVT_DIRCREATE:
|
487 |
LOGDEB(("Monitor: Modify/Check on %s\n", ev.m_path.c_str()));
|
489 |
LOGDEB(("Monitor: Modify/Check on %s\n", ev.m_path.c_str()));
|
488 |
modified.push_back(ev.m_path);
|
490 |
modified.push_back(ev.m_path);
|
489 |
break;
|
491 |
break;
|
490 |
case RclMonEvent::RCLEVT_DELETE:
|
492 |
case RclMonEvent::RCLEVT_DELETE:
|
491 |
LOGDEB(("Monitor: Delete on %s\n", ev.m_path.c_str()));
|
493 |
LOGDEB(("Monitor: Delete on %s\n", ev.m_path.c_str()));
|
|
|
494 |
// If this is for a directory (which the caller should
|
|
|
495 |
// tell us because he knows), we should purge the db
|
|
|
496 |
// of all the subtree, because on a directory rename,
|
|
|
497 |
// inotify will only generate one event for the
|
|
|
498 |
// renamed top, not the subentries. This is relatively
|
|
|
499 |
// complicated to do though, and we currently do not
|
|
|
500 |
// do it, and just wait for a restart to do a full run and
|
|
|
501 |
// purge.
|
492 |
deleted.push_back(ev.m_path);
|
502 |
deleted.push_back(ev.m_path);
|
|
|
503 |
if (ev.evflags() & RclMonEvent::RCLEVT_ISDIR) {
|
|
|
504 |
list<string> paths;
|
|
|
505 |
if (subtreelist(conf, ev.m_path, paths)) {
|
|
|
506 |
deleted.insert(deleted.end(),
|
|
|
507 |
paths.begin(), paths.end());
|
|
|
508 |
}
|
|
|
509 |
}
|
493 |
break;
|
510 |
break;
|
494 |
default:
|
511 |
default:
|
495 |
LOGDEB(("Monitor: got Other on [%s]\n", ev.m_path.c_str()));
|
512 |
LOGDEB(("Monitor: got Other on [%s]\n", ev.m_path.c_str()));
|
496 |
}
|
513 |
}
|
497 |
}
|
514 |
}
|