[tpop3d-discuss] bandwidth statistics

Chris Lightfoot chris at ex-parrot.com
Mon, 19 Aug 2002 16:33:19 +0100


On Mon, Aug 19, 2002 at 04:25:51PM +0200, klebermass@limtec.de wrote:
> Wouldnt it be a nice feature to implement the traffic accounting into the
> main programm ,as optional feature for the mysql auth type.
> ( You can allready update your database with the information of the actual
> IP,  so why not also update a field with the read and written
> bytes).

This is not trivial without some design changes, since the
bandwidth information is written by the child process
after the fork. The child process does not hold a database
handle for security reasons, and for simplicity of design
child processes do not communicate information back to the
parent tpop3d (in fact, the only interaction is handling
SIGCHLD and maintaining a count of active children). The
POP-before-SMTP hooks run in the parent process
immediately after forking the child process, so that they
have access to all of the database handles etc. available
to the parent and its authenticators.

One could envisage opening a pipe from the child to the
parent, down which a count of bytes read/written could be
sent when the session ends; the parent would then have
access to this information and could log it. I'm unwilling
to make this change unless there's a fair amount of demand
for it, since it's pretty easy to just grind over the log
and extract the information that way, and doesn't require
an ugly change to the daemon.

-- 
``What would you call the creation of the universe?''
``The Horrendous Space Kablooie!''
  (Calvin and Hobbes)