diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2020-04-18 22:18:39 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2020-04-18 22:18:39 +0300 |
commit | 5e93c56acf080ef006176076be4efab4aa0591c0 (patch) | |
tree | ce5a296fcbb5c47823e2ba3343b3673e7cc5d6b4 /src/wydawca.h | |
parent | 7c8140491ce8547fe45a791fb0a185817b5ff8ec (diff) | |
download | wydawca-5e93c56acf080ef006176076be4efab4aa0591c0.tar.gz wydawca-5e93c56acf080ef006176076be4efab4aa0591c0.tar.bz2 |
Fix statistics gathering. Display stats at the end of the run in cron mode.
* src/directive.c (process_directives): Raise the 'destroying' flag
prior to removing the directive file, in order to avoid the removal
being caught by the watcher thread.
* src/timer.c (wydawca_stats_export, wydawca_stats_update): New
functions.
* src/triplet.c (triplet_list_lock,triplet_list_unlock): Check for
NULL pointer.
(remove_triplet_unlocked): Set the 'destroying' flag.
(triplet_remove_file): Do nothing if the 'destroying' flag is set.
(wy_thr_triplet): Call logstats only in the daemon mode. Otherwise
call wydawca_stats_update.
* src/wydawca.c (wy_main): Call wydawca_stats_export at the beginning.
Call logstats before exiting, unless in daemon mode.
* src/wydawca.h (struct wy_triplet): New member: destroying.
(wydawca_stats_export,wydawca_stats_update): New protos.
* tests/check-fail.at: Update.
* tests/check-notify.at: Update.
* tests/upl12f.at: Update.
Diffstat (limited to 'src/wydawca.h')
-rw-r--r-- | src/wydawca.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wydawca.h b/src/wydawca.h index 92a73fd..2c1c3de 100644 --- a/src/wydawca.h +++ b/src/wydawca.h @@ -189,6 +189,7 @@ struct wy_triplet { points to a triplet newer than it: */ struct wy_triplet *prev, *next; struct triplet_list *list; + int destroying; /* True if the triplet is being destroyed */ /* User data */ struct wy_user *uploader_list; struct wy_user *uploader; @@ -365,8 +366,9 @@ increase_stat_counter(int what) } int stat_mask_p(unsigned long mask); -void initstats(void); void logstats(void); +void wydawca_stats_export(void); +void wydawca_stats_update(void); /* Utility functions */ char *safe_file_name(char *file_name); |