[Twisted-Python] Re: [Twisted-commits] r17913 - Merge forward
On Tue, 22 Aug 2006 01:10:46 -0600, Jonathan Lange
Modified: branches/cleantests-1883-2/twisted/web/test/test_distrib.py ============================================================================== --- branches/cleantests-1883-2/twisted/web/test/test_distrib.py (original) +++ branches/cleantests-1883-2/twisted/web/test/test_distrib.py Tue Aug 22 01:10:44 2006 @@ -15,16 +15,37 @@ self.logFile.close() del self.logFile
+ +def fireOnClose(protocol): + d = defer.Deferred() + oldConnectionLost = protocol.connectionLost + def connectionLost(*a): + oldConnectionLost(*a) + d.callback(None) + protocol.connectionLost = connectionLost + return d + + +class PBServerFactory(pb.PBServerFactory): + onClose = None + + def buildProtocol(self, addr): + proto = pb.PBServerFactory.buildProtocol(self, addr) + self.onClose = fireOnClose(proto) + return proto
Would it make sense to use notifyOnDisconnect here, instead of all this custom scaffolding? Jean-Paul
participants (1)
-
Jean-Paul Calderone