More logging for rssclient and pop3client holdoff and concurrency checks
authorArt Cancro <ajc@uncensored.citadel.org>
Wed, 25 Apr 2012 21:24:37 +0000 (17:24 -0400)
committerArt Cancro <ajc@uncensored.citadel.org>
Wed, 25 Apr 2012 21:24:37 +0000 (17:24 -0400)
citadel/modules/pop3client/serv_pop3client.c
citadel/modules/rssclient/serv_rssclient.c
citadel/modules/smtp/serv_smtpeventclient.c

index 826a191abb4baae3bfb6ebf436e147d3690ce32b..e559f2824a5025212cddafd917c83db18598993f 100644 (file)
@@ -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 <stdlib.h>
@@ -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, "<PASS <password>\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");
index 6d4392393610785433efc3caad7f91067519afa5..bbf3c0c78431c2693773fef2f620453ce76d328b 100644 (file)
@@ -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 <stdlib.h>
@@ -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");
index 2869b8d44cc7e06c2531e71026f88bed4674549b..f15a18564a669a43266edb6ae1f4996d4578b47d 100644 (file)
@@ -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,