diff --git a/postfix.py b/postfix.py index d1a9da8..f3ee6b4 100644 --- a/postfix.py +++ b/postfix.py @@ -27,10 +27,14 @@ from twisted.protocols.basic import LineOnlyReceiver from twisted.internet.protocol import Factory +from twisted.internet.interfaces import IHalfCloseableProtocol +from zope.interface import implements class PostfixPolicy(LineOnlyReceiver): '''Basic implementation of a Postfix policy service.''' + implements(IHalfCloseableProtocol) + def __init__(self): self.params = {} self.delimiter = '\n' @@ -70,5 +74,12 @@ def send_action (self, action='DUNNO'): ''' self.sendLine('action=%s\n' % action) + def readConnectionLost(self): + pass + + def writeConnectionLost(self): + self.transport.loseConnection() + + class PostfixPolicyFactory(Factory): protocol = PostfixPolicy