Paul Murphy wrote:

> You can do anything you want, as long as you open the connection in
> filter_initialize(), and close it in filter_cleanup()

That's one strategy.  I prefer to "lazily" open and close the connection.
That is, have a wrapper function called "get_mysql_handle" that checks if
there is an existing handle, and returns it if so.  Otherwise, it opens
a connection and caches the handle in a global variable.

This function can also do a "ping" test and close and reopen the handle
if the ping test fails.  That way, if someone restarts the MySQL server,
the MIMEDefang slaves can react properly by closing and reopening the
connection automatically.

In filter_cleanup, you can (should) close any cached MySQL connection.

Regards,

David.
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

Reply via email to