mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Doesn't start sync if Ctrl+C is pressed.
This commit is contained in:
parent
7fa93e6c98
commit
cefe021e60
3 changed files with 13 additions and 3 deletions
12
state.c
12
state.c
|
|
@ -2240,7 +2240,7 @@ void state_filter(struct snapraid_state* state, tommy_list* filterlist_file, tom
|
|||
}
|
||||
}
|
||||
|
||||
void state_progress_begin(struct snapraid_state* state, block_off_t blockstart, block_off_t blockmax, block_off_t countmax)
|
||||
int state_progress_begin(struct snapraid_state* state, block_off_t blockstart, block_off_t blockmax, block_off_t countmax)
|
||||
{
|
||||
if (state->opt.gui) {
|
||||
fprintf(stdlog,"run:begin:%u:%u:%u\n", blockstart, blockmax, countmax);
|
||||
|
|
@ -2254,6 +2254,16 @@ void state_progress_begin(struct snapraid_state* state, block_off_t blockstart,
|
|||
state->progress_last = now;
|
||||
state->progress_subtract = 0;
|
||||
}
|
||||
|
||||
/* stop if requested */
|
||||
if (global_interrupt) {
|
||||
if (!state->opt.gui) {
|
||||
printf("Not starting for interruption\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void state_progress_end(struct snapraid_state* state, block_off_t countpos, block_off_t countmax, data_off_t countsize)
|
||||
|
|
|
|||
2
state.h
2
state.h
|
|
@ -174,7 +174,7 @@ void state_filter(struct snapraid_state* state, tommy_list* filterlist_file, tom
|
|||
/**
|
||||
* Begins the progress visualization.
|
||||
*/
|
||||
void state_progress_begin(struct snapraid_state* state, block_off_t blockstart, block_off_t blockmax, block_off_t countmax);
|
||||
int state_progress_begin(struct snapraid_state* state, block_off_t blockstart, block_off_t blockmax, block_off_t countmax);
|
||||
|
||||
/**
|
||||
* Ends the progress visualization.
|
||||
|
|
|
|||
2
sync.c
2
sync.c
|
|
@ -116,7 +116,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
|
|||
|
||||
countsize = 0;
|
||||
countpos = 0;
|
||||
state_progress_begin(state, blockstart, blockmax, countmax);
|
||||
if (state_progress_begin(state, blockstart, blockmax, countmax))
|
||||
for(i=blockstart;i<blockmax;++i) {
|
||||
int one_invalid;
|
||||
int one_valid;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue