chiark / gitweb /
abolish xk_Malloc
[inn-innduct.git] / backends / innduct.c
index 3da59e101c02dfc3134e71857d4e4ca8b6b71af9..8c9d769fee9a04f5f35d5773033b527b4191feea 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * todo
+ *  - rename sm_period_counter as it's just about flushes
  *  - manpage: document control master stuff
  *
  * debugging rune:
@@ -408,13 +409,12 @@ typedef enum {
 #define CONNIOVS 128
 
 typedef enum {
-  xk_Malloc, xk_Const, xk_Artdata
+  xk_Const, xk_Artdata
 } XmitKind;
 
 struct XmitDetails {
   XmitKind kind;
   union {
-    char *malloc_tofree;
     ARTHANDLE *sm_art;
   } info;
 };
@@ -1511,7 +1511,6 @@ static void xmit_artbody(Conn *conn, ARTHANDLE *ah /* consumed */) {
 
 static void xmit_free(XmitDetails *d) {
   switch (d->kind) {
-  case xk_Malloc:  free(d->info.malloc_tofree);   break;
   case xk_Artdata: SMfreearticle(d->info.sm_art); break;
   case xk_Const:                                  break;
   default: abort();
@@ -1975,7 +1974,7 @@ static void *feedfile_got_article(oop_source *lp, oop_read *rd,
   ipf->readcount_ok++;
 
   art= xmalloc(sizeof(*art) - 1 + midlen + 1);
-  memset(art,0,sizeof(art));
+  memset(art,0,sizeof(*art));
   art->state= art_Unchecked;
   art->midlen= midlen;
   art->ipf= ipf;  ipf->inprogress++;
@@ -2280,7 +2279,7 @@ static void inputfile_reading_stop(InputFile *ipf) {
      |      flsh->rd!=0       |     |              flsh->rd!=0
      |     [Separated]        |     |             [Dropping]
      |      main F idle       |     |              main none
-     |      old D tail        |     |              old D tail
+     |      flsh D tail       |     |              flsh D tail
      |     =============      |     |             ============
      |          |             |     | install       |
      ^          | EOF ON D    |     |  defer        | EOF ON D
@@ -2290,7 +2289,7 @@ static void inputfile_reading_stop(InputFile *ipf) {
      |      flsh->rd==0       |     V              flsh->rd==0
      |     [Finishing]        |     |             [Dropping]
      |      main F tail              |     `.             main none
-     |      old D closed      |       `.           old D closed
+     |      flsh D closed     |       `.           flsh D closed
      |     ===============    V                `.        ===============
      |          |                        `.          |
      |          | ALL D PROCESSED           `.        | ALL D PROCESSED
@@ -2303,7 +2302,7 @@ static void inputfile_reading_stop(InputFile *ipf) {
                                                 DROPPED
                                                [Dropped]
                                                 main none
-                                                old none
+                                                flsh none
                                                 some backlog
                                                ==============
                                                      |
@@ -2419,6 +2418,9 @@ static void statemc_init(void) {
     if (file_d) {
       debug("startup: F!=D => Separated");
       startup_set_input_file(file_d);
+      flushing_input_file= main_input_file;
+      main_input_file= open_input_file(feedfile);
+      if (!main_input_file) die("feedfile vanished during startup");
       SMS(SEPARATED, 0, "found both old and current feed files");
     } else {
       debug("startup: F exists, D ENOENT => Normal");
@@ -2796,7 +2798,7 @@ static void search_backlog_file(void) {
 static void preterminate(void) {
   if (in_child) return;
   notice_processed(main_input_file,0,"feedfile","");
-  notice_processed(flushing_input_file,0,"flushing file","");
+  notice_processed(flushing_input_file,0,"flushing","");
   if (backlog_input_file)
     notice_processed(backlog_input_file,0, "backlog file ",
                     backlog_input_file->path);
@@ -3197,16 +3199,8 @@ CCMD(dump) {
       char *dinfo;
       long diff;
       switch (xd->kind) {
-      case xk_Malloc:
-       diff= xd->info.malloc_tofree - (char*)iv->iov_base;
-       dinfo= xasprintf("M%5ld", diff);
-       break;
-      case xk_Const:
-       dinfo= xasprintf("Const");
-       break;
-      case xk_Artdata:
-       dinfo= xasprintf("A%p", xd->info.sm_art);
-       break;
+      case xk_Const:    dinfo= xasprintf("Const");                 break;
+      case xk_Artdata:  dinfo= xasprintf("A%p", xd->info.sm_art);  break;
       default:
        abort();
       }