Louis,
I tested your version late this morning. It worked as far as I could
tell. However, I felt that efficiency wise we could do better, so I
combined both yours and mine and formed another patch. Please let me
know whether it works for you.
I also spotted the reason why in my original, unfinished, patch, the
second strerr_warn1() stayed silent. It should. After pop3_quit(),
the program die()s, and I placed the strerr_warn1 after
commands(&ssin,pop3commands); in the main(). Thus it became a still
born :(
Thanks again for this fruitful exchange.
Best Regards,
Chin Fang
[EMAIL PROTECTED]
------------------------------------------------------------------------------
*** qmail-pop3d.c.orig Sun May 21 13:12:07 2000
--- qmail-pop3d.c Sun May 21 16:02:08 2000
***************
*** 16,21 ****
--- 16,33 ----
#include "readwrite.h"
#include "timeoutread.h"
#include "timeoutwrite.h"
+ #include "strerr.h"
+
+ /*
+ ** patched qmail-pop3d.c so that the downloaded bytes (including protocol
+ ** overhead) can be logged via multilog. To use this version, line 91 of
+ ** qmail-popup.c should be either deleted or commented out and then
+ ** rebuilt.
+ **
+ ** C. Fang 05/21/2000 <[EMAIL PROTECTED]>
+ */
+
+ unsigned long msgbytesread = 0;
void die() { _exit(0); }
***************
*** 35,40 ****
--- 47,64 ----
return r;
}
+ /* @@@ generating log messages */
+ char msgbytes_str[FMT_ULONG];
+ char pid_str[FMT_ULONG];
+
+ void log_bytes(msgbytesread) unsigned long msgbytesread;
+ {
+ msgbytes_str[fmt_ulong(msgbytes_str,msgbytesread)];
+ pid_str[fmt_uint(pid_str,getpid())];
+
+ strerr_warn5("qmail-pop3d ",pid_str,": ",msgbytes_str," message bytes read",
0);
+ }
+
char ssoutbuf[1024];
substdio ssout = SUBSTDIO_FDBUF(safewrite,1,ssoutbuf,sizeof ssoutbuf);
***************
*** 99,111 ****
if (!line.len)
inheaders = 0;
else
! if (line.s[0] == '.')
put(".",1);
put(line.s,line.len);
put("\r\n",2);
if (!match) break;
}
put("\r\n.\r\n",5);
flush();
}
--- 123,140 ----
if (!line.len)
inheaders = 0;
else
! if (line.s[0] == '.') {
put(".",1);
+ msgbytesread++;
+ }
put(line.s,line.len);
+ msgbytesread += line.len;
put("\r\n",2);
+ msgbytesread += 2;
if (!match) break;
}
put("\r\n.\r\n",5);
+ msgbytesread += 5;
flush();
}
***************
*** 193,198 ****
--- 222,228 ----
rename(m[i].fn,line.s); /* if it fails, bummer */
}
okay();
+ log_bytes(msgbytesread);
die();
}