phalaaxx / milter

A golang library for milter support
BSD 2-Clause "Simplified" License
46 stars 22 forks source link

Fixed session disconnection #16

Closed mschneider82 closed 5 years ago

mschneider82 commented 5 years ago

Added Init() and Disconnect() to the interface.

Init() which is called before the first mail and after the end-of-body, and also on RSET (abort command), so you can cleanup and init.

Disconnect() which is called when the client disconnects (if you have a concurrent session counter you can decrease the counter there, this was not possible before)

this fixes #7

Also fixes Handling if the milter rejects only some rcpts (not all), in the previous implementation the milter disconnects the session on a single rcpt rejected.

The disconnect behaviour now follows this: https://github.com/phalaaxx/milter/blob/master/milter-protocol.txt#L137

Tested Init() with postfix and "RSET" during a session, and also with end of body.