X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fpop3client%2Fserv_pop3client.c;h=e20f16f70aabd19a4ecb6e0e9ec64c8b301b42f1;hb=5268c0a9bf8202336b9e3e8b86f45d9d010f2811;hp=0790cb52043677987cbb8be22e8cf4810b963cd4;hpb=a80ade9d4c5b3e0dcd31b44418c5271e0c89a337;p=citadel.git diff --git a/citadel/modules/pop3client/serv_pop3client.c b/citadel/modules/pop3client/serv_pop3client.c index 0790cb520..e20f16f70 100644 --- a/citadel/modules/pop3client/serv_pop3client.c +++ b/citadel/modules/pop3client/serv_pop3client.c @@ -165,8 +165,8 @@ eNextState FinalizePOP3AggrRun(AsyncIO *IO) It = GetNewHashPos(POP3FetchUrls, 0); pthread_mutex_lock(&POP3QueueMutex); { - GetHashPosFromKey(POP3FetchUrls, SKEY(cptr->Url), It); - DeleteEntryFromHash(POP3FetchUrls, It); + if (GetHashPosFromKey(POP3FetchUrls, SKEY(cptr->Url), It)) + DeleteEntryFromHash(POP3FetchUrls, It); } pthread_mutex_unlock(&POP3QueueMutex); DeleteHashPos(&It); @@ -596,6 +596,7 @@ void POP3SetTimeout(eNextState NextTCPState, pop3aggr *pMsg) syslog(LOG_DEBUG, "POP3: %s\n", __FUNCTION__); switch (NextTCPState) { + case eSendFile: case eSendReply: case eSendMore: Timeout = POP3_C_SendTimeouts[pMsg->State]; @@ -606,6 +607,7 @@ void POP3SetTimeout(eNextState NextTCPState, pop3aggr *pMsg) } */ break; + case eReadFile: case eReadMessage: Timeout = POP3_C_ReadTimeouts[pMsg->State]; /* @@ -720,12 +722,14 @@ eReadState POP3_C_ReadServerStatus(AsyncIO *IO) case eAbort: Finished = eReadFail; break; + case eSendFile: case eSendReply: case eSendMore: case eReadMore: case eReadMessage: Finished = StrBufChunkSipLine(IO->IOBuf, &IO->RecvBuf); break; + case eReadFile: case eReadPayload: Finished = CtdlReadMessageBodyAsync(IO); break; @@ -848,7 +852,7 @@ int pop3_do_fetching(pop3aggr *cpptr) cpptr->IO.Terminate = POP3_C_Terminate; cpptr->IO.LineReader = POP3_C_ReadServerStatus; cpptr->IO.ConnFail = POP3_C_ConnFail; - cpptr->IO.DNSFail = POP3_C_DNSFail; + cpptr->IO.DNS.Fail = POP3_C_DNSFail; cpptr->IO.Timeout = POP3_C_Timeout; cpptr->IO.ShutdownAbort = POP3_C_Shutdown; @@ -865,6 +869,9 @@ int pop3_do_fetching(pop3aggr *cpptr) SubC = CloneContext (&pop3_client_CC); SubC->session_specific_data = (char*) cpptr; cpptr->IO.CitContext = SubC; + safestrncpy(SubC->cs_host, + ChrPtr(cpptr->Url), + sizeof(SubC->cs_host)); if (cpptr->IO.ConnectMe->IsIP) { QueueEventContext(&cpptr->IO, @@ -1042,10 +1049,10 @@ void pop3client_scan_room(struct ctdlroom *qrbuf, void *data) FreeStrBuf(&CfgData); } +static int doing_pop3client = 0; void pop3client_scan(void) { static time_t last_run = 0L; - static int doing_pop3client = 0; /// struct pop3aggr *pptr; time_t fastest_scan; HashPos *it; @@ -1110,7 +1117,8 @@ void pop3client_scan(void) { void pop3_cleanup(void) { /* citthread_mutex_destroy(&POP3QueueMutex); TODO */ -// DeleteHash(&POP3FetchUrls); + while (doing_pop3client != 0) ; + DeleteHash(&POP3FetchUrls); DeleteHash(&POP3QueueRooms); }