From 1031a8f51b546c9707b494fc5e88cd571efb94da Mon Sep 17 00:00:00 2001 From: Dave West Date: Sat, 29 Mar 2008 14:19:05 +0000 Subject: [PATCH] No code changes, just cleaned some warnings and some comments. --- citadel/modules/vandelay/serv_vandelay.c | 48 ++++-------------------- 1 file changed, 8 insertions(+), 40 deletions(-) diff --git a/citadel/modules/vandelay/serv_vandelay.c b/citadel/modules/vandelay/serv_vandelay.c index c55329ea4..f76bf965b 100644 --- a/citadel/modules/vandelay/serv_vandelay.c +++ b/citadel/modules/vandelay/serv_vandelay.c @@ -696,10 +696,7 @@ void artv_import_message(long *iterations, char **b64buf, size_t *b64size, char struct MetaData smi; long msgnum; long msglen; - FILE *fp; char buf[SIZ]; - char tempfile[PATH_MAX]; - char *mbuf; size_t b64len = 0; char *tbuf, *tbuf2; size_t mlen; @@ -745,53 +742,24 @@ void artv_import_message(long *iterations, char **b64buf, size_t *b64size, char b64len += mlen; } + /** + * FIXME: This is an ideal place for a "sub thread". What we should do is create a new thread + * This new thread would be given the base64 encoded message, it would then decode it and store + * it. This would allow the thread that is reading from the client to continue doing so, basically + * backgrounding the decode and store operation. This would increase the speed of the import from + * the users perspective. + */ + /** * Decode and store the message * If this decode and store takes more than 5 seconds the sendcommand WD timer may expire. - * This is the reason for outputting a dot before and after. */ msglen = CtdlDecodeBase64(*plain, *b64buf, b64len); -// cprintdot(iterations); CtdlLogPrintf(CTDL_DEBUG, "msglen = %ld\n", msglen); cdb_store(CDB_MSGMAIN, &msgnum, sizeof(long), *plain, msglen); -// cprintdot(iterations); PutMetaData(&smi); CtdlLogPrintf(CTDL_INFO, "Imported message %ld\n", msgnum); -/* - CtdlMakeTempFileName(tempfile, sizeof tempfile); - snprintf(buf, sizeof buf, "%s -d >%s", file_base64, tempfile); - fp = popen(buf, "w"); - while (client_getln(buf, sizeof buf) >= 0 , strcasecmp(buf, END_OF_MESSAGE)) { - if (CtdlThreadCheckStop()) - { - pclose(fp); - unlink (tempfile); - return; - } - cprintdot(iterations); - fprintf(fp, "%s\n", buf); - } - pclose(fp); - fp = fopen(tempfile, "rb"); - fseek(fp, 0L, SEEK_END); - msglen = ftell(fp); - fclose(fp); - CtdlLogPrintf(CTDL_DEBUG, "msglen = %ld\n", msglen); - - mbuf = malloc(msglen); - fp = fopen(tempfile, "rb"); - fread(mbuf, msglen, 1, fp); - fclose(fp); - - cdb_store(CDB_MSGMAIN, &msgnum, sizeof(long), mbuf, msglen); - - free(mbuf); - unlink(tempfile); - - PutMetaData(&smi); - CtdlLogPrintf(CTDL_INFO, "Imported message %ld\n", msgnum); -*/ } -- 2.39.2