/*
- * bugs
- *
-
- [740] <sit> info: processed feedfile(null) read=4(+0bl,+6err) offered=5(ch5,nc0) accepted=0(ch0+nc0) unwanted=0(0id+0bd+0nc) rejected=0(0id+0bd+0nc) deferred=0(0id+0bd+0nc) missing=2(0id+2bd+0nc) connretry=0(0id+0bd+0nc)
-
- also unwanted should be nonzero I think
-
- [740] <sit> warning: corrupted file: /home/ian/things/Innfeed/inn2-2.4.5/fee, offset 349: line partially blanked: in ` @050000002D130000006A0000000000000000@ <mi'..
-
-
-
+ * warning if no inotify
+ * inotify not working ?
* some per-conn info thing for control
* todo
+
* - actually do something with readable on control master
* - option for realsockdir
* - option for filepoll
(abort(),-1);
if (!artdata) art->missing= 1;
-fprintf(stderr,"INC %d %d?%d:%d\n",(int)art->state,
- !!artdata, (int)RC_sent, (int)RC_missing);
art->ipf->counts[art->state][ artdata ? RC_sent : RC_missing ]++;
if (conn->stream) {
XMIT_LITERAL("\r\n");
assert(art->state == art_Unchecked);
-fprintf(stderr,"INC %d %d\n",(int)art->state,(int)RC_sent);
art->ipf->counts[art->state][RC_sent]++;
LIST_ADDTAIL(conn->sent, art);
}
}
static void article_done(Conn *conn, Article *art, int whichcount) {
-fprintf(stderr,"INC %d %d\n",(int)art->state,whichcount);
if (!art->missing) art->ipf->counts[art->state][whichcount]++;
if (whichcount == RC_accepted) update_nocheck(1);
case 335: /* IHAVE says send it */
GET_ARTICLE(-1);
assert(art->state == art_Unchecked);
-fprintf(stderr,"INC %d %d\n",(int)art->state,(int)RC_accepted);
art->ipf->counts[art->state][RC_accepted]++;
art->state= art_Wanted;
LIST_ADDTAIL(conn->priority, art);
art->midlen= midlen;
art->ipf= ipf; ipf->inprogress++;
art->token= TextToToken(tokentextbuf);
- art->offset= ipf->offset;
+ art->offset= old_offset;
art->blanklen= recsz;
strcpy(art->messageid, space+1);
LIST_ADDTAIL(queue, art);
/*---------- filemon implemented with inotify ----------*/
-#if defined(HAVE_INOTIFY) && !defined(HAVE_FILEMON)
+#if defined(HAVE_SYS_INOTIFY_H) && !defined(HAVE_FILEMON)
#define HAVE_FILEMON
-#include <linux/inotify.h>
+#include <sys/inotify.h>
static int filemon_inotify_fd;
static int filemon_inotify_wdmax;
if (wd >= filemon_inotify_wdmax) {
int newmax= wd+2;
- filemon_inotify_wd= xrealloc(filemon_inotify_wd2ipf,
+ filemon_inotify_wd2ipf= xrealloc(filemon_inotify_wd2ipf,
sizeof(*filemon_inotify_wd2ipf) * newmax);
memset(filemon_inotify_wd2ipf + filemon_inotify_wdmax, 0,
sizeof(*filemon_inotify_wd2ipf) * (newmax - filemon_inotify_wdmax));
static void filemon_method_stopfile(InputFile *ipf, Filemon_Perfile *pf) {
int wd= pf->wd;
debug("filemon inotify stopfile %p wd=%d", ipf, wd);
- int r= inotify_rm_watch(filemon_inotify_fd, filemon_inotify_wd);
+ int r= inotify_rm_watch(filemon_inotify_fd, wd);
if (r) sysdie("inotify_rm_watch");
filemon_inotify_wd2ipf[wd]= 0;
}
die("inotify read %d bytes wanted struct of %d", r, (int)sizeof(iev));
}
InputFile *ipf= filemon_inotify_wd2ipf[iev.wd];
- debug("filemon inotify readable read %p wd=%p", iev.wd, ipf);
+ debug("filemon inotify readable read %d wd=%p", iev.wd, ipf);
filemon_callback(ipf);
}
return OOP_CONTINUE;
static int filemon_method_init(void) {
filemon_inotify_fd= inotify_init();
if (filemon_inotify_fd<0) {
- syswarn("could not initialise inotify: inotify_init failed");
+ syswarn("filemon/inotify: inotify_init failed");
return 0;
}
- set nonblock;
- loop->on_fd(loop, filemon_inotify_fd, OOP_READ, filemon_inotify_readable);
+ xsetnonblock(filemon_inotify_fd, 1);
+ loop->on_fd(loop, filemon_inotify_fd, OOP_READ, filemon_inotify_readable, 0);
debug("filemon inotify init filemon_inotify_fd=%d", filemon_inotify_fd);
return 1;
struct Filemon_Perfile { int dummy; };
-static int filemon_method_init(void) { return 0; }
+static int filemon_method_init(void) {
+ warn("filemon/dummy: no filemon method compiled in");
+ return 0;
+}
static void filemon_method_startfile(InputFile *ipf, Filemon_Perfile *pf) { }
static void filemon_method_stopfile(InputFile *ipf, Filemon_Perfile *pf) { }
control_init();
if (!filemon_method_init()) {
- warn("no file monitoring available, polling");
+ warn("filemon: no file monitoring available, polling");
every(5,0,filepoll);
}