chiark
/
gitweb
/
~ian
/
innduct.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ff034fb
)
Always call cancel_time before on_time to make sure we have only one queued up
author
Ian Jackson
<ian@chiark.greenend.org.uk>
Tue, 1 Jun 2010 15:21:03 +0000
(16:21 +0100)
committer
Ian Jackson
<ian@chiark.greenend.org.uk>
Tue, 1 Jun 2010 15:21:03 +0000
(16:21 +0100)
infile.c
patch
|
blob
|
history
diff --git
a/infile.c
b/infile.c
index 3c93d1f2d1c796b171f61d8382e19e2ade19c70d..32c44977cde15c68434de40d87bdeb21ff766937 100644
(file)
--- a/
infile.c
+++ b/
infile.c
@@
-178,6
+178,8
@@
static void *feedfile_got_article(oop_source *lp, oop_read *rd,
/*========== tailing input file ==========*/
/*========== 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
static void *tailing_rable_call_time(oop_source *lp, struct timeval tv,
void *user) {
/* lifetime of ipf here is OK because destruction will cause
@@
-190,13
+192,20
@@
static void *tailing_rable_call_time(oop_source *lp, struct timeval tv,
/* 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);
/* 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);
}
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);
static void tailing_on_cancel(struct oop_readable *rable) {
InputFile *ipf= (void*)rable;
dbg("**TOR** ipf=%p on_cancel",ipf);
@@
-213,7
+222,7
@@
void tailing_make_readable(InputFile *ipf) {
if (!ipf || !ipf->readable_callback) /* so callers can be naive */
return;
ipf->fake_readable= 1;
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,
}
static int tailing_on_readable(struct oop_readable *rable,