From 00a46dcdfd9920d3966274aebc4e50b4c88eb549 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 25 Apr 2012 17:24:37 -0400 Subject: [PATCH] More logging for rssclient and pop3client holdoff and concurrency checks --- citadel/modules/pop3client/serv_pop3client.c | 33 ++++++++++---------- citadel/modules/rssclient/serv_rssclient.c | 19 ++++++----- citadel/modules/smtp/serv_smtpeventclient.c | 4 +-- 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/citadel/modules/pop3client/serv_pop3client.c b/citadel/modules/pop3client/serv_pop3client.c index 826a191ab..e559f2824 100644 --- a/citadel/modules/pop3client/serv_pop3client.c +++ b/citadel/modules/pop3client/serv_pop3client.c @@ -1,21 +1,15 @@ /* * Consolidate mail from remote POP3 accounts. * - * Copyright (c) 2007-2011 by the citadel.org team + * Copyright (c) 2007-2012 by the citadel.org team * * This program is open source 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. + * modify it under the terms of the GNU General Public License version 3. * * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include @@ -52,7 +46,6 @@ #include "citadel_dirs.h" #include "event_client.h" - #define POP3C_OK (strncasecmp(ChrPtr(RecvMsg->IO.IOBuf), "+OK", 3) == 0) #define POP3C_DBG_SEND() \ @@ -66,7 +59,6 @@ RecvMsg->n, \ ChrPtr(RecvMsg->IO.IOBuf)) - struct CitContext pop3_client_CC; pthread_mutex_t POP3QueueMutex; /* locks the access to the following vars: */ @@ -224,7 +216,7 @@ eNextState POP3C_SendPassword(pop3aggr *RecvMsg) StrBufPrintf(RecvMsg->IO.SendBuf.Buf, "PASS %s\r\n", ChrPtr(RecvMsg->pop3pass)); syslog(LOG_DEBUG, "\n"); -// POP3C_DBG_SEND(); No, we won't write the passvoid to syslog... +// POP3C_DBG_SEND(); No, we won't write the password to syslog... return eReadMessage; } @@ -750,9 +742,9 @@ eNextState POP3_C_Shutdown(AsyncIO *IO) } -/** - * @brief lineread Handler; understands when to read more POP3 lines, - * and when this is a one-lined reply. +/* + * lineread Handler; understands when to read more POP3 lines, + * and when this is a one-lined reply. */ eReadState POP3_C_ReadServerStatus(AsyncIO *IO) { @@ -784,7 +776,8 @@ eReadState POP3_C_ReadServerStatus(AsyncIO *IO) /***************************************************************************** * So we connect our Server IP here. * - *****************************************************************************/ + ***************************************************************************** + */ eNextState POP3_C_ReAttachToFetchMessages(AsyncIO *IO) { pop3aggr *cpptr = IO->Data; @@ -1117,6 +1110,11 @@ void pop3client_scan(void) { * Run POP3 aggregation no more frequently than once every n seconds */ if ( (time(NULL) - last_run) < fastest_scan ) { + syslog(LOG_DEBUG, + "pop3client: polling interval not yet reached; last run was %ldm%lds ago", + ((time(NULL) - last_run) / 60), + ((time(NULL) - last_run) % 60) + ); return; } @@ -1126,7 +1124,10 @@ void pop3client_scan(void) { * don't really require extremely fine granularity here, we'll do it * with a static variable instead. */ - if (doing_pop3client) return; + if (doing_pop3client) { + syslog(LOG_DEBUG, "pop3client: concurrency check failed; another poll is already running"); + return; + } doing_pop3client = 1; syslog(LOG_DEBUG, "pop3client started"); diff --git a/citadel/modules/rssclient/serv_rssclient.c b/citadel/modules/rssclient/serv_rssclient.c index 6d4392393..bbf3c0c78 100644 --- a/citadel/modules/rssclient/serv_rssclient.c +++ b/citadel/modules/rssclient/serv_rssclient.c @@ -5,17 +5,11 @@ * * This program is open source software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3. - * - * * * 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. - * - * - * - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA */ #include @@ -508,6 +502,11 @@ void rssclient_scan(void) { /* Run no more than once every 15 minutes. */ if ((now - last_run) < 900) { + syslog(LOG_DEBUG, + "rssclient: polling interval not yet reached; last run was %ldm%lds ago", + ((now - last_run) / 60), + ((now - last_run) % 60) + ); return; } @@ -518,8 +517,14 @@ void rssclient_scan(void) { * with a static variable instead. */ - if ((GetCount(RSSQueueRooms) > 0) || (GetCount(RSSFetchUrls) > 0)) + if ((GetCount(RSSQueueRooms) > 0) || (GetCount(RSSFetchUrls) > 0)) { + syslog(LOG_DEBUG, + "rssclient: concurrency check failed; %d rooms and %d url's are queued", + GetCount(RSSQueueRooms), + GetCount(RSSFetchUrls) + ); return; + } become_session(&rss_CC); syslog(LOG_DEBUG, "rssclient started\n"); diff --git a/citadel/modules/smtp/serv_smtpeventclient.c b/citadel/modules/smtp/serv_smtpeventclient.c index 2869b8d44..f15a18564 100644 --- a/citadel/modules/smtp/serv_smtpeventclient.c +++ b/citadel/modules/smtp/serv_smtpeventclient.c @@ -141,14 +141,14 @@ inline void FinalizeMessageSend_1(AsyncIO *IO) SmtpOutMsg *Msg = IO->Data; if (Msg->MyQEntry->Status == 2) - Status = "Delivery Successfull."; + Status = "Delivery successful."; else if (Msg->MyQEntry->Status == 5) Status = "Delivery failed permanently; giving up."; else Status = "Delivery failed temporarily; will retry later."; EVS_syslog(LOG_INFO, - "SMTP: %s Time[%fs] Recipient <%s> @ <%s> (%s) Statusmessage: %s\n", + "SMTP: %s Time[%fs] Recipient <%s> @ <%s> (%s) Status message: %s\n", Status, Msg->IO.Now - Msg->IO.StartIO, Msg->user, -- 2.30.2