[Twisted-Python] Foolscap-0.1.1 released

kgi iacovou at gmail.com
Wed Apr 11 08:39:54 MDT 2007


On Wednesday 04 April 2007 07:36, Brian Warner wrote:
> I've just released Foolscap-0.1.1, the next-generation-of-PB RPC library,

Hi Brian,

Thanks for the latest release; Foolscap is turning out to be very powerful and 
pleasant to use. I appreciate all your work.

I have two questions.

1. I'm trying to create an UnauthenticatedTub that listens on a 
system-assigned port (that is, on "tcp:0"). (I do this because I pass the 
underlying Referenceable to a remote server, and the random port is just a 
convenience to assist in debugging).

Combining the example in the documentation and the comments in foolscap/pb.py 
(particularly the Listener class) implies that something like this might be 
possible:

class MyServer ( Referenceable ):
    def remote_Foo ( self, blah ):
        return blah

myserver = MyServer()
tub = UnauthenticatedTub()
l = tub.listenOn("tcp:0")
tub.setLocation("localhost:%d" % l.getPortnum() )
url = tub.registerReference(myserver, "my-service")
print "the object is available at:", url

tub.startService()
reactor.run()

However, when code like this runs, it falls foul of the "assert 
self.s.running" at pb.py:73 (in getPortnum()).

This seems to imply that the reactor needs to be running before we can 
actually assign a port, so we can't call setLocation() or registerReference() 
until this is done. However, I can't see where I would hang my callback to 
perform the remained of the setup once the reactor had started.

2. I sent an email a while back about a possible bug I found; the archived 
version is here:

  http://twistedmatrix.com/pipermail/twisted-python/2007-March/014914.html

The behaviour I describe is still present in SVN, so I run against a patched 
install which seems to cure the problem, although I'm not claiming that it's 
The Right Way to solve it.

Cheers,

Ricky




More information about the Twisted-Python mailing list