char utmsgid[SIZ];
struct cdbdata *cdbut;
struct UseTable ut;
+ CitContext *CCC=CC;
CtdlLogPrintf(CTDL_DEBUG, "POP3: %s %s %s <password>\n", roomname, pop3host, pop3user);
CtdlLogPrintf(CTDL_NOTICE, "Connecting to <%s>\n", pop3host);
goto bail;
CtdlLogPrintf(CTDL_DEBUG, "Connected!\n");
+ CCC->sReadBuf = NewStrBuf();
+ CCC->sMigrateBuf = NewStrBuf();
+ CCC->sPos = NULL;
/* Read the server greeting */
if (sock_getln(&sock, buf, sizeof buf) < 0) goto bail;
if (sock_getln(&sock, buf, sizeof buf) < 0) goto bail;
CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
bail:
+ FreeStrBuf(&CCC->sReadBuf);
+ FreeStrBuf(&CCC->sMigrateBuf);
+
if (sock != -1)
sock_close(sock);
if (msglist) free(msglist);
static int doing_pop3client = 0;
struct pop3aggr *pptr;
time_t fastest_scan;
-
+ CitContext popclientCC;
+
+ /* Give this thread its own private CitContext */
+ CtdlFillSystemContext(&popclientCC, "popclient");
+ citthread_setspecific(MyConKey, (void *)&popclientCC );
+
if (config.c_pop3_fastest < config.c_pop3_fetch)
fastest_scan = config.c_pop3_fastest;
else
* Run POP3 aggregation no more frequently than once every n seconds
*/
if ( (time(NULL) - last_run) < fastest_scan ) {
+ CtdlClearSystemContext();
return;
}
* don't really require extremely fine granularity here, we'll do it
* with a static variable instead.
*/
- if (doing_pop3client) return;
+ if (doing_pop3client) {
+ CtdlClearSystemContext();
+ return;
+ }
doing_pop3client = 1;
CtdlLogPrintf(CTDL_DEBUG, "pop3client started\n");
CtdlLogPrintf(CTDL_DEBUG, "pop3client ended\n");
last_run = time(NULL);
doing_pop3client = 0;
+ CtdlClearSystemContext();
}