[Dovecot] Developing new Dspam Plugin
Johannes Berg
johannes at sipsolutions.net
Mon Jun 26 09:21:53 EEST 2006
On Fri, 2006-06-23 at 20:27 +0800, Timothy White wrote:
> I have successfully modified Johannes plugin to call SPAM and HAM in
> the database, with the signatures,
Your call_dspam routine is a bit bogus, the neither exit(127) nor return
-1 can ever execute ;) The original code must have had something like
that because it was forking, but your code doesn't.
Same goes for mysqlinit(), you shouldn't exit() from a plugin, just
return an error to the imap connection. If you exit(), the imap
connection dies.
Also, you should lazily init the mysql connection and then either close
it, or keep it open and re-use it, currently you don't close it but
re-init the mysql context and reconnect, that's probably going to create
a bunch of stale connections to the database.
If you decide to go for the route that keeps the connection open for the
next time, then you will need to check for disconnects before using the
connection again, the database might have been restarted and you don't
want the plugin to fall on its nose over that, it should just
reconnect...
johannes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 793 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20060626/59e96e56/attachment.pgp
More information about the dovecot
mailing list