X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Frssclient%2Frss_atom_parser.c;h=e7065bde39c6ac2fe54e8d407b189203d1898a5e;hb=c855d497545dad80942a194624c111a54cd1fdc7;hp=d60d35ae2b0c1644ea51b4a77aa00a5afb5ab120;hpb=5ec1b7756ba201839aac2dfbf9165a1888f93a0d;p=citadel.git diff --git a/citadel/modules/rssclient/rss_atom_parser.c b/citadel/modules/rssclient/rss_atom_parser.c index d60d35ae2..e7065bde3 100644 --- a/citadel/modules/rssclient/rss_atom_parser.c +++ b/citadel/modules/rssclient/rss_atom_parser.c @@ -144,7 +144,7 @@ void rss_xml_start(void *data, const char *supplied_el, const char **attr) char *sep = NULL; /* Axe the namespace, we don't care about it */ -/// CtdlLogPrintf(0, "RSS: supplied el %d: %s...\n", rssc->Cfg->ItemType, supplied_el); +/// syslog(LOG_DEBUG, "RSS: supplied el %d: %s...\n", rssc->Cfg->ItemType, supplied_el); pel = supplied_el; while (sep = strchr(pel, ':'), sep) { pel = sep + 1; @@ -160,7 +160,7 @@ void rss_xml_start(void *data, const char *supplied_el, const char **attr) &v)) { #ifdef DEBUG_RSS - CtdlLogPrintf(0, "RSS: START ignoring because of wrong namespace [%s] = [%s]\n", + syslog(LOG_DEBUG, "RSS: START ignoring because of wrong namespace [%s]\n", supplied_el); #endif return; @@ -190,12 +190,12 @@ void rss_xml_start(void *data, const char *supplied_el, const char **attr) } #ifdef DEBUG_RSS else - CtdlLogPrintf(0, "RSS: START unhandled: [%s] [%s]...\n", pel, supplied_el); + syslog(LOG_DEBUG, "RSS: START unhandled: [%s] [%s]...\n", pel, supplied_el); #endif } #ifdef DEBUG_RSS else - CtdlLogPrintf(0, "RSS: START unhandled: [%s] [%s]...\n", pel, supplied_el); + syslog(LOG_DEBUG, "RSS: START unhandled: [%s] [%s]...\n", pel, supplied_el); #endif } @@ -213,7 +213,7 @@ void rss_xml_end(void *data, const char *supplied_el) while (sep = strchr(pel, ':'), sep) { pel = sep + 1; } -// CtdlLogPrintf(0, "RSS: END %s...\n", el); +// syslog(LOG_DEBUG, "RSS: END %s...\n", el); if (pel != supplied_el) { void *v; @@ -224,7 +224,7 @@ void rss_xml_end(void *data, const char *supplied_el) &v)) { #ifdef DEBUG_RSS - CtdlLogPrintf(0, "RSS: END ignoring because of wrong namespace [%s] = [%s]\n", + syslog(LOG_DEBUG, "RSS: END ignoring because of wrong namespace [%s] = [%s]\n", supplied_el, ChrPtr(rssc->CData)); #endif FlushStrBuf(rssc->CData); @@ -255,12 +255,12 @@ void rss_xml_end(void *data, const char *supplied_el) } #ifdef DEBUG_RSS else - CtdlLogPrintf(0, "RSS: END unhandled: [%s] [%s] = [%s]...\n", pel, supplied_el, ChrPtr(rssc->CData)); + syslog(LOG_DEBUG, "RSS: END unhandled: [%s] [%s] = [%s]...\n", pel, supplied_el, ChrPtr(rssc->CData)); #endif } #ifdef DEBUG_RSS else - CtdlLogPrintf(0, "RSS: END unhandled: [%s] [%s] = [%s]...\n", pel, supplied_el, ChrPtr(rssc->CData)); + syslog(LOG_DEBUG, "RSS: END unhandled: [%s] [%s] = [%s]...\n", pel, supplied_el, ChrPtr(rssc->CData)); #endif FlushStrBuf(rssc->CData); rssc->Current = NULL; @@ -607,7 +607,7 @@ size_t rss_libcurl_callback(void *ptr, size_t size, size_t nmemb, void *stream) -eNextState ParseRSSReply(AsyncIO *IO) +eNextState RSSAggregator_ParseReply(AsyncIO *IO) { StrBuf *Buf; rss_aggregator *rssc; @@ -617,10 +617,17 @@ eNextState ParseRSSReply(AsyncIO *IO) long len; const char *Key; + + if (IO->HttpReq.httpcode != 200) + { + + EV_syslog(LOG_DEBUG, "need a 200, got a %ld !\n", + IO->HttpReq.httpcode); +// TODO: aide error message with rate limit + return eAbort; + } + rssc = IO->Data; - pthread_mutex_lock(&RSSQueueMutex); - rssc->RefCount ++; - pthread_mutex_unlock(&RSSQueueMutex); ri = rssc->Item; rssc->CData = NewStrBufPlain(NULL, SIZ); rssc->Key = NewStrBuf(); @@ -649,10 +656,7 @@ eNextState ParseRSSReply(AsyncIO *IO) rssc->xp = XML_ParserCreateNS(ptr, ':'); if (!rssc->xp) { syslog(LOG_DEBUG, "Cannot create XML parser!\n"); - pthread_mutex_lock(&RSSQueueMutex); - rssc->RefCount --; - pthread_mutex_unlock(&RSSQueueMutex); - return eTerminateConnection; + return eAbort; } FlushStrBuf(rssc->Key);