diff options
Diffstat (limited to 'networking')
-rw-r--r-- | networking/httppost.c | 10 | ||||
-rw-r--r-- | networking/rptaddrs.c | 6 |
2 files changed, 12 insertions, 4 deletions
diff --git a/networking/httppost.c b/networking/httppost.c index 03cd72c..b6e01da 100644 --- a/networking/httppost.c +++ b/networking/httppost.c @@ -21,6 +21,9 @@ #define SAFE_PREFIX_DATA_NEW ATLAS_DATA_NEW #define SAFE_PREFIX_STATUS ATLAS_STATUS +/* Maximum number of files to post in one go with post-dir */ +#define MAX_FILES 1000 + struct option longopts[]= { { "delete-file", no_argument, NULL, 'd' }, @@ -939,6 +942,7 @@ static int connect_to_name(char *host, char *port) char *do_dir(char *dir_name, off_t curr_tot_size, off_t max_size, off_t *lenp) { + int file_count; size_t currsize, allocsize, dirlen, len; char *list, *tmplist, *path; DIR *dir; @@ -952,6 +956,7 @@ char *do_dir(char *dir_name, off_t curr_tot_size, off_t max_size, off_t *lenp) *lenp= 0; currsize= 0; allocsize= 0; + file_count= 0; list= NULL; dir= opendir(dir_name); if (dir == NULL) @@ -1012,6 +1017,11 @@ char *do_dir(char *dir_name, off_t curr_tot_size, off_t max_size, off_t *lenp) currsize += len; curr_tot_size += sb.st_size; *lenp += sb.st_size; + + file_count++; + + if (file_count >= MAX_FILES) + break; } closedir(dir); diff --git a/networking/rptaddrs.c b/networking/rptaddrs.c index 33d20cf..8506ac8 100644 --- a/networking/rptaddrs.c +++ b/networking/rptaddrs.c @@ -642,12 +642,10 @@ static int check_cache(char *cache_name) need_report= 0; if (stat(cache_name, &sb) == 0 && - sb.st_mtime < time(NULL) - 30 * 24 * 3600) + sb.st_mtime < time(NULL) - 3600) { /* This basically makes sure that this information gets - * reported again when the clock is set for the first time. - * A side effect is that it gets reported once a month if - * nothing changes. + * reported regularly. */ need_report= 1; } |