Here a list of fixes present in CPUShare-Twisted mercurial tree and missing in Twisted SVN trunk. Most of these have been posted as a ticket in trac without feedback (by now the links in the tickets are obsolete due to bugs in tailor that required a rebuild of the SVN->HG repository, but nobody asked about the dangling link anyway). So I rensend them here just in case somebody is interested. I will not answer to replies because I've no time, sorry. Each email contains one patch.
This fixes a reentrance problem in connectionLost if invoked by shutdown at the same time as the real disconnect.
diff -r 493b5c24e0f3 twisted/internet/process.py --- a/twisted/internet/process.py Tue May 16 04:57:00 2006 +0000 +++ b/twisted/internet/process.py Wed May 17 15:59:28 2006 +0200 @@ -82,7 +82,24 @@ def detectLinuxBrokenPipeBehavior(): # Call at import time detectLinuxBrokenPipeBehavior()
-class ProcessWriter(abstract.FileDescriptor): +class ProcessReaderWriter(abstract.FileDescriptor): + """(Internal) Helper class to avoid code duplication between + ProcessReader and ProcessWriter.""" + def connectionLost(self, reason): + """Close my end of the pipe, signal the Process (which signals the + ProcessProtocol). + See also abstract.FileDescriptor.connectionLost. + """ + # connectionLost can be called multiple times, for example + # both from the loseConnection timer, and from the + # shutdown event as well, but childConnectionLost + # needs to be invoked only once + disconnected = self.disconnected + abstract.FileDescriptor.connectionLost(self, reason) + if not disconnected: + self.proc.childConnectionLost(self.name, reason) + +class ProcessWriter(ProcessReaderWriter): """(Internal) Helper class to write into a Process's input pipe.
I am a helper which describes a selectable asynchronous writer to a @@ -174,14 +191,8 @@ class ProcessWriter(abstract.FileDescrip else: self.stopReading()
- def connectionLost(self, reason): - """See abstract.FileDescriptor.connectionLost. - """ - abstract.FileDescriptor.connectionLost(self, reason) - self.proc.childConnectionLost(self.name, reason) - - -class ProcessReader(abstract.FileDescriptor): + +class ProcessReader(ProcessReaderWriter): """ProcessReader
I am a selectable representation of a process's output pipe, such as @@ -224,13 +235,6 @@ class ProcessReader(abstract.FileDescrip self.disconnecting = 1 self.stopReading() self.reactor.callLater(0, self.connectionLost, failure.Failure(CONNECTION_DONE)) - - def connectionLost(self, reason): - """Close my end of the pipe, signal the Process (which signals the - ProcessProtocol). - """ - abstract.FileDescriptor.connectionLost(self, reason) - self.proc.childConnectionLost(self.name, reason)
class Process(styles.Ephemeral):