[Twisted-Python] Getting Rid of Application in a Compatible Way
glyph at twistedmatrix.com
Mon Jun 16 07:45:24 EDT 2003
(This is in reply to a message sent last month, so apologies if it
doesn't thread properly.)
On Friday, May 23, 2003, at 02:02 AM, Moshe Zadka wrote:
> class TCPListener(ApplicationService):
I want to implement this, and also to move ApplicationService into its
own module and rename it (commensurate with cred changes) -
> def __init__(self, port, factory, backlog=5, interface='', *args,
> def startService(self):
> self._port = reactor.listenTCP(self.port, self.factory,
This is great, except for the fact that UNIX likes to make it so that
only root can bind ports, and that would be way too much work to run in
a privileged mode. We need to separate initializeService() (which runs
with privileges) and startService() (which runs without). This would
> TCPListener(8080, server.Site(resource),
The 'setServiceParent' seems a little unweildy. Why not in the
> The only problem is needing to choose unique names.
Rather than use the opaque key you suggest, which would be potentially
confusing to sysadmins, we could use a simple sequence number? Putting
sequence number generation into Application is probably not such a bad
I would really like this refactoring to happen soon, because
Application is an ungodly mess. So, to sum up -
* move Service to new module
* write TCPListenerService, SSLConnectService, etc
* write backwards-compatible listen|connectTCP/SSL/etc
* update _all_ uses of app.(listen|connect)(TCP|SSL|UNIX) in Twisted.
* write upgrade function to upgrade Application's mutable state.
Does anybody feel like doing something like this?
More information about the Twisted-Python