summaryrefslogtreecommitdiff
path: root/src/htsback.c
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2012-03-19 13:00:04 +0000
committerXavier Roche <xroche@users.noreply.github.com>2012-03-19 13:00:04 +0000
commit4aec03f2cbabc19cf31e7d6f9fdcd6c84cfa861e (patch)
tree06ba27421c30be1aa1f3c4e911e7a7c7d4ed28fc /src/htsback.c
parent660b569b0980fc8f71b03ed666dd02eec8388b4c (diff)
httrack 3.42.3
Diffstat (limited to 'src/htsback.c')
-rw-r--r--src/htsback.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/htsback.c b/src/htsback.c
index 2f06b09..91245a7 100644
--- a/src/htsback.c
+++ b/src/htsback.c
@@ -3649,19 +3649,27 @@ int back_checksize(httrackp* opt,lien_back* eback,int check_only_totalsize) {
}
int back_checkmirror(httrackp* opt) {
- // Check max time
+ // Check max size
if ((opt->maxsite>0) && (HTS_STAT.stat_bytes >= opt->maxsite)) {
- if (opt->log) {
- fprintf(opt->log,"More than "LLintP" bytes have been transfered.. giving up"LF,(LLint)opt->maxsite);
- test_flush;
- }
- return 0;
- } else if ((opt->maxtime>0) && ((time_local()-HTS_STAT.stat_timestart)>opt->maxtime)) {
+ if (!opt->state.stop) { /* not yet stopped */
+ if (opt->log) {
+ fprintf(opt->log,"More than "LLintP" bytes have been transfered.. giving up"LF,(LLint)opt->maxsite);
+ test_flush;
+ }
+ /* cancel mirror smoothly */
+ hts_request_stop(opt, 0);
+ }
+ return 1; /* don'k break mirror too sharply for size limits, but stop requested */
+ /*return 0;
+ */
+ }
+ // Check max time
+ if ((opt->maxtime>0) && ((time_local()-HTS_STAT.stat_timestart)>opt->maxtime)) {
if (opt->log) {
fprintf(opt->log,"More than %d seconds passed.. giving up"LF,opt->maxtime);
test_flush;
- }
- return 0;
+ }
+ return 0; /* stop now */
}
return 1; /* Ok, go on */
}