- /* finally we go to sleep until our parent kills us
- * with a USR2 signal. We sleep for a short time as on
- * some OSes a signal won't interrupt a sleep! */
+
+ /* Handle any keep-alive packets from the post-processing work
+ * that the generator does. */
+ if (protocol_version >= 29) {
+ kluge_around_eof = -1;
+
+ /* This should only get stopped via a USR2 signal. */
+ while (read_int(f_in) == flist->count
+ && read_shortint(f_in) == ITEM_IS_NEW) {}
+
+ rprintf(FERROR, "Invalid packet at end of run [%s]\n",
+ who_am_i());
+ exit_cleanup(RERR_PROTOCOL);
+ }
+
+ /* Finally, we go to sleep until our parent kills us with a
+ * USR2 signal. We sleep for a short time, as on some OSes
+ * a signal won't interrupt a sleep! */