[Twisted-Python] an easy twisted application question

Moshe Zadka twisted at zadka.site.co.il
Thu Nov 13 00:44:03 MST 2003


On Wed, 12 Nov 2003, "Phil Christensen" <phil at bubblehouse.org> wrote:

> so i followed jp's advice, and my makeService method now looks like this:
> 
> 
> ###############code#################
> def makeService(config):
>     registry = Registry()
>     reg_service = RegistryService(registry)
>     portal = Portal(auth.InnerSpaceRealm(reg_service))
>     checker = auth.RegistryChecker(registry)
>     portal.registerChecker(checker)
>     pb_service = internet.TCPServer(int(config['port']),
>                                     pb.PBServerFactory(portal))
>     reg_service.setServiceParent(pb_service)
>     return pb_service

Don't use a TCPServer as a parent, use a multi-service

    m = service.MultiService()
    reg_service.setServiceParent(m)
    pb_service.setServiceParent(m)
    return m




More information about the Twisted-Python mailing list