-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Hi and thanks a lot for this module!
I'm not sure if this is an issue or I'm just missing something.
When using setReply() in a callback (e.g. eob()), what should I return?
If I return libmilter.REJECT, like:
self.setReply(b'550', b'5.7.1', b'Service unavailable') # Sends a 'y' packet
return libmilter.REJECT # Sends a 'r' packet
the milter will send two replies to the MTA (reply AND reject).
This double reply is generating quite a few issues to me when the email client doesn't close the connection and keeps sending emails over the same connection: the MTA (Postfix) thinks the second reply actually comes from the next callback, ending up in a kind of "desync" between MTA calls and milter replies.
I found a workaround (but I'm not sure if it's a workaround or the right thing to do), which is returning a Deferred() instance instead of REJECT, e.g.:
self.setReply(b'550', b'5.7.1', b'Service unavailable')
return libmilter.Deferred()
I hope my description is not too messy...
So my question is: what is the correct value to return after setReply()? Is it REJECT, than there's an issue in the module, or Deferred(), than it's ok, but maybe the documentation should be more explicit on this point...
Thanks a lot in advance for your help!
Cheers,
Daniele