+/*
+ * innduct
+ * tailing reliable realtime streaming feeder for inn
+ * xmit.c - transmitting checks and articles, flow control, expiry
+ *
+ * Copyright (C) 2010 Ian Jackson <ijackson@chiark.greenend.org.uk>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * (I believe that when you compile and link this as part of the inn2
+ * build, with the Makefile runes I have provided, all the libraries
+ * and files which end up included in innduct are licence-compatible
+ * with GPLv3. If not then please let me know. -Ian Jackson.)
+ */
+
+#include "innduct.h"
+
+const char *const artstate_names[]=
+ { "Unchecked", "Wanted", "Unsolicited", 0 };
+
/*---------- assigning articles to conns, and transmitting ----------*/
static Article *dequeue_from(int peek, InputFile *ipf) {
return 0;
}
-static void check_assign_articles(void) {
+void check_assign_articles(void) {
for (;;) {
if (!dequeue(1))
break;
return OOP_CONTINUE;
}
-static void conn_maybe_write(Conn *conn) {
+void conn_maybe_write(Conn *conn) {
for (;;) {
conn_make_some_xmits(conn);
if (!conn->xmitu) {
* pause/resume inputfile tailing
*/
-static void check_reading_pause_resume(InputFile *ipf) {
+void check_reading_pause_resume(InputFile *ipf) {
if (ipf->queue.count >= max_queue_per_ipf)
inputfile_reading_pause(ipf);
else
inputfile_reading_resume(ipf);
}
-static void article_defer(Article *art /* not on a queue */, int whichcount) {
+void article_defer(Article *art /* not on a queue */, int whichcount) {
open_defer();
if (fprintf(defer, "%s %s\n", TokenToText(art->token), art->messageid) <0
|| fflush(defer))
article_done(art, whichcount);
}
-static int article_check_expired(Article *art /* must be queued, not conn */) {
+int article_check_expired(Article *art /* must be queued, not conn */) {
ARTHANDLE *artdata= SMretrieve(art->token, RETR_STAT);
if (artdata) { SMfreearticle(artdata); return 0; }
check_reading_pause_resume(ipf);
}
-static void article_autodefer(InputFile *ipf, Article *art) {
+void article_autodefer(InputFile *ipf, Article *art) {
ipf->autodefer++;
article_defer(art,-1);
}
article_autodefer(ipf, art);
}
-static void autodefer_input_file(InputFile *ipf) {
+void autodefer_input_file(InputFile *ipf) {
static const char *const abandon= "stuck";
ipf->autodefer= 0;
d->info.sm_art= ah;
}
-static void xmit_free(XmitDetails *d) {
+void xmit_free(XmitDetails *d) {
switch (d->kind) {
case xk_Artdata: SMfreearticle(d->info.sm_art); break;
case xk_Const: break;
}
}
-static void *conn_write_some_xmits(Conn *conn) {
+void *conn_write_some_xmits(Conn *conn) {
/* return values:
* 0: nothing more to write, no need to call us again
* OOP_CONTINUE: more to write but fd not writeable
}
}
-static void conn_make_some_xmits(Conn *conn) {
+void conn_make_some_xmits(Conn *conn) {
for (;;) {
if (conn->xmitu+5 > CONNIOVS)
break;