/*========== tailing input file ==========*/
+static void tailing_rable_on_time(InputFile *ipf);
+
static void *tailing_rable_call_time(oop_source *lp, struct timeval tv,
void *user) {
/* lifetime of ipf here is OK because destruction will cause
/* we just keep calling readable until our caller (oop_rd)
* has called try_read, and try_read has found EOF so given EAGAIN */
dbg("**TRACT** ipf=%p reschedule",ipf);
- loop->on_time(loop, OOP_TIME_NOW, tailing_rable_call_time, ipf);
+ tailing_rable_on_time(ipf);
- assert(ipf->readable_callback):
+ assert(ipf->readable_callback);
return ipf->readable_callback(loop, &ipf->readable,
ipf->readable_callback_user);
}
+static void tailing_rable_on_time(InputFile *ipf) {
+ loop->cancel_time(loop, OOP_TIME_NOW, tailing_rable_call_time, ipf);
+ loop->on_time(loop, OOP_TIME_NOW, tailing_rable_call_time, ipf);
+ /* on_time is not idempotent - it counts. So we need this to make
+ * sure we only have one outstanding, as otherwise our cancel doesn't work */
+}
+
static void tailing_on_cancel(struct oop_readable *rable) {
InputFile *ipf= (void*)rable;
dbg("**TOR** ipf=%p on_cancel",ipf);
if (!ipf || !ipf->readable_callback) /* so callers can be naive */
return;
ipf->fake_readable= 1;
- loop->on_time(loop, OOP_TIME_NOW, tailing_rable_call_time, ipf);
+ tailing_rable_on_time(ipf);
}
static int tailing_on_readable(struct oop_readable *rable,