chiark / gitweb /
rename sm_period_counter to until_flush
[innduct.git] / backends / innduct.c
index 8c9d769fee9a04f5f35d5773033b527b4191feea..f5ab08e581d27311106a2c068c215672f6370830 100644 (file)
@@ -1,6 +1,5 @@
 /*
  * todo
- *  - rename sm_period_counter as it's just about flushes
  *  - manpage: document control master stuff
  *
  * debugging rune:
@@ -499,7 +498,7 @@ static pid_t self_pid;
 
 /* statemc_init initialises */
 static StateMachineState sms;
-static int sm_period_counter;
+static int until_flush;
 static InputFile *main_input_file, *flushing_input_file, *backlog_input_file;
 static FILE *defer;
 
@@ -848,7 +847,7 @@ static const ControlCommand control_commands[]= {
   { "p",             ccmd_period    },
 
 #define POKES(cmd,func)                                                        \
-  { cmd "sm",        func,           &sm_period_counter,       1 },    \
+  { cmd "sm",        func,           &until_flush,             1 },    \
   { cmd "conn",      func,           &until_connect,           0 },    \
   { cmd "blscan",    func,           &until_backlog_nextscan,  0 },
 POKES("prod ", ccmd_setint_period)
@@ -2439,7 +2438,7 @@ static void statemc_start_flush(const char *why) { /* Normal => Flushing */
        why,
        (unsigned long)(main_input_file ? main_input_file->offset : 0),
        (unsigned long)target_max_feedfile_size,
-       sm_period_counter);
+       until_flush);
 
   int r= link(feedfile, path_flushing);
   if (r) sysfatal("link feedfile %s to flushing file %s",
@@ -2466,11 +2465,11 @@ static int trigger_flush_ok(void) { /* => Flushing,FLUSHING, ret 1; or ret 0 */
 }
 
 static void statemc_period_poll(void) {
-  if (!sm_period_counter) return;
-  sm_period_counter--;
-  assert(sm_period_counter>=0);
+  if (!until_flush) return;
+  until_flush--;
+  assert(until_flush>=0);
 
-  if (sm_period_counter) return;
+  if (until_flush) return;
   int ok= trigger_flush_ok();
   assert(ok);
 }
@@ -2580,7 +2579,7 @@ static void queue_check_input_done(void) {
 static void statemc_setstate(StateMachineState newsms, int periods,
                             const char *forlog, const char *why) {
   sms= newsms;
-  sm_period_counter= periods;
+  until_flush= periods;
 
   const char *xtra= "";
   switch (sms) {
@@ -3081,7 +3080,7 @@ static void period(void) {
        " input_files main:%s flushing:%s backlog:%s"
        " children connecting=%ld inndcomm=%ld"
        ,
-       sms_names[sms], sm_period_counter,
+       sms_names[sms], until_flush,
          conns.count, queue.count, until_connect,
        dipf_main, dipf_flushing, dipf_backlog,
        (long)connecting_child, (long)inndcomm_child
@@ -3152,7 +3151,7 @@ CCMD(dump) {
 
   fprintf(f,"general");
   DUMPV("%s", sms_names,[sms]);
-  DUMPV("%d", ,sm_period_counter);
+  DUMPV("%d", ,until_flush);
   DUMPV("%ld", (long),self_pid);
   DUMPV("%p", , defer);
   DUMPV("%d", , until_connect);