From b948b6b98e193fcf49332249666cae766f60d026 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Sun, 5 Dec 2010 15:38:31 +0100 Subject: [PATCH] implement IHalfCloseableProtocol so exim can do its shutdown(fd, SHUT_WR) closes #5 --- postfix.py | 11 +++++++++++ 1 file changed, 11 insertions(+) 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