[Twisted-Python] signaling failure to IConsumer

Clark C. Evans cce at clarkevans.com
Tue Jun 10 05:21:45 EDT 2003

In the process of linking the flow module with IConsumer/IProducer,
I happened to lack any way for the producer to signal to the 
consumer that it had an exception and is now inactive.  A simple
'fail()' method should be added to IConsumer so that the receiver
of a data flow can have some resonable way of knowing the sender
has failed.  Without further ado,

--- interfaces.py.orig	Tue Jun 10 04:49:24 2003
+++ interfaces.py	Tue Jun 10 04:50:23 2003
@@ -682,6 +682,9 @@
     def write(self, data):
         """The producer will write data by calling this method."""
+    def fail(self, failure):
+        """The producer created an exception and has since died horribly."""
 class IFinishableConsumer(IConsumer):
     """A Consumer for producers that finish.

More information about the Twisted-Python mailing list