Mailing List Archive

Does insert_messages() also make a zillion pipes?
Hey, I'm reading more code and in pipe.c, does insert_messages() create an
open pipe to sendmail for each forward in the same way as injector.c?

Aaron
Re: Does insert_messages() also make a zillion pipes? [ In reply to ]
Ok, I kinda get it. The code is a bit spaghetti, IMHO. I need a map!

main.c calls insert_messages() in pipe.c, which accepts a header and a few
lists of destinations. Some parsing of the header and the destination
lists produces the following:

List of no-such-user bounces
List of database deliveries
List of external forwards

The no such user bounces are sent immediately with only the header and are
not dealt with again.

If there is at least one database delivery, then stdin is read and each
block in set into the database. The messageid of one of these deliveries
is kept in a variable for later use.

If there are external forwards, then insert_messages() calls
pipe_forward() in forward.c with several arguments, two of which are
really pertinent: a FILE* pointer (hardcoded to stdin) and the messageid
that was saved earlier.

If the messageid is valid, then pipe_forward() goes through the list of
forwards, opens up a pipe to it, retrieves the message from the database,
and send it on its way. Repeat for each forward.

If the messageis is not valid, then pipe_forward() sets up an open pipe
for each of the forwards, reads in a block from the FILE* pointer (hurray!
not hardcoded to stdin!), then loops through the open pipes to send that
block. Repeat until stdin is empty.


It is this last case which is most concerning. Again, as with injector.c,
if there are a large number of external forwards then we're really loading
down the machine! So about those temporary tables...

Aaron


On Sun, 20 Apr 2003, Aaron Stone wrote:

> Hey, I'm reading more code and in pipe.c, does insert_messages() create an
> open pipe to sendmail for each forward in the same way as injector.c?
>
> Aaron
>
> _______________________________________________
> Dbmail-dev mailing list
> Dbmail-dev@dbmail.org
> http://twister.fastxs.net/mailman/listinfo/dbmail-dev
>