Browse Source

ckdb - use new shutdown for the confirmer

master
kanoi 10 years ago
parent
commit
6891895cb3
  1. 18
      src/ckdb.c
  2. 2
      src/ckdb.h

18
src/ckdb.c

@ -3473,6 +3473,8 @@ int main(int argc, char **argv)
if (confirm_sharesummary) {
// TODO: add a system lock to stop running 2 at once?
confirm_summaries();
everyone_die = true;
socketer_release = summariser_release = listener_release = true;
} else {
ckp.main.sockname = strdup("listener");
write_namepid(&ckp.main);
@ -3488,26 +3490,27 @@ int main(int argc, char **argv)
/* Shutdown from here if the listener is sent a shutdown message */
join_pthread(ckp.pth_listener);
}
time_t start, trigger, now;
time_t start, trigger, curr;
char *msg = NULL;
trigger = start = time(NULL);
while (!socketer_release || !summariser_release ||
!logger_release || !listener_release) {
msg = NULL;
now = time(NULL);
if (now - start > 4) {
if (now - trigger > 4) {
curr = time(NULL);
if (curr - start > 4) {
if (curr - trigger > 4) {
msg = "Shutdown initial delay";
} else if (now - trigger > 2) {
} else if (curr - trigger > 2) {
msg = "Shutdown delay";
}
}
if (msg) {
trigger = now;
trigger = curr;
printf("%s %ds due to%s%s%s%s\n",
msg, (int)(now - start),
msg, (int)(curr - start),
socketer_release ? EMPTY : " socketer",
summariser_release ? EMPTY : " summariser",
logger_release ? EMPTY : " logger",
@ -3518,7 +3521,6 @@ int main(int argc, char **argv)
}
dealloc_storage();
}
clean_up(&ckp);

2
src/ckdb.h

@ -52,7 +52,7 @@
#define DB_VLOCK "1"
#define DB_VERSION "0.9.2"
#define CKDB_VERSION DB_VERSION"-0.593"
#define CKDB_VERSION DB_VERSION"-0.594"
#define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__

Loading…
Cancel
Save