[Twisted-Python] Triggering callbacks on raw file descriptors

James Y Knight foom at fuhm.net
Mon Jan 9 12:24:47 EST 2006

On Jan 9, 2006, at 11:51 AM, Brian Granger wrote:
> Adding connectionLost to the IFileDescriptor interface does solve  
> the problem.  But the situation is more complicated than that - and  
> that makes me a little hesitant to just have connectionLost in  
> IFileDescriptor as you have done.  Here is why:
> The IReactorFDSet interface, specifies that any class that  
> implements the IReadDescriptor can be used as a reader.  But,  
> currently, the reactor's, which supposedly IReactorFDSet implements  
> also call the following on the readers:
> logPrefix -- part of twisted.python.log.Logger which FileDescriptor  
> (the class) inherits from
> connectionLost -- now part of IFileDescriptor
> Thus is looks like readers are actually required to also be a  
> subclass of the Logger class (the FileDescriptor class, which is  
> used for Port does this).  The problem seems to be with the  
> IReactorFDSset interface which doesn't actually specify acccurately  
> which interfaces (and subclasses) the  readers/writers must  
> implement.  Is there a ILogger interface as well?
> Also, this makes me worry that developers have been asusming that  
> readers are actually a subclass of FileDescriptor.  Is that the case?

This is most likely true and unfortunate. Thanks for helping to track  
down these issues. What we really need is some test coverage of the  
reactor being used with alternative IFileDescriptors that only  
implement the minimal advertised interfaces.

> I am not that experienced with this part of twisted, so I am not  
> sure what is the best solution.

The right solution is to fix this part of the spec. I do think that  
connectionLost is a fundemental part of the interface. However, I do  
not think logPrefix ought to be. That should be fixed to be optional.


More information about the Twisted-Python mailing list