git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/doldaconnect@1041
959494ce-11ee-0310-bf91-
de5d638817bd
* job. */
static pid_t hashjob = -1;
struct sharecache *shareroot = NULL;
* job. */
static pid_t hashjob = -1;
struct sharecache *shareroot = NULL;
-static time_t lastscan = 0;
+static struct timer *scantimer = NULL;
unsigned long long sharesize = 0;
GCBCHAIN(sharechangecb, unsigned long long);
unsigned long long sharesize = 0;
GCBCHAIN(sharechangecb, unsigned long long);
+static void rescancb(int cancelled, void *uudata)
+{
+ scantimer = NULL;
+ if(!cancelled)
+ {
+ if(scanqueue == NULL)
+ scanshares();
+ else if(confgetint("cli", "rescandelay") > 0)
+ scantimer = timercallback(ntime() + confgetint("cli", "rescandelay"), (void (*)(int, void *))rescancb, NULL);
+ }
+}
+
void scanshares(void)
{
struct sharepoint *cur;
void scanshares(void)
{
struct sharepoint *cur;
+ if(scantimer != NULL)
+ canceltimer(scantimer);
+ if(confgetint("cli", "rescandelay") > 0)
+ scantimer = timercallback(ntime() + confgetint("cli", "rescandelay"), (void (*)(int, void *))rescancb, NULL);
}
static void preinit(int hup)
}
static void preinit(int hup)
+static int rsdelayupdate(struct configvar *var, void *uudata)
+{
+ if(scantimer != NULL)
+ canceltimer(scantimer);
+ if(confgetint("cli", "rescandelay") > 0)
+ scantimer = timercallback(ntime() + var->val.num, (void (*)(int, void *))rescancb, NULL);
+ return(0);
+}
+
static int init(int hup)
{
struct sharepoint *cur, *next;
static int init(int hup)
{
struct sharepoint *cur, *next;
+ CBREG(confgetvar("cli", "rescandelay"), conf_update, rsdelayupdate, NULL, NULL);
+ }
struct hash *parsehash(wchar_t *text);
wchar_t *unparsehash(struct hash *hash);
int hashcmp(struct hash *h1, struct hash *h2);
struct hash *parsehash(wchar_t *text);
wchar_t *unparsehash(struct hash *hash);
int hashcmp(struct hash *h1, struct hash *h2);
extern struct sharecache *shareroot;
extern unsigned long long sharesize;
extern struct sharecache *shareroot;
extern unsigned long long sharesize;