Exemplo n.º 1
0
    def makeService(self, options):
        if not options['noisy-logging']:
            protocol.Factory.noisy = False
            
        endpoint = twitterEndpoint(options['endpoint'])
        tickeryService = service.MultiService()
        cache = TickeryCache(
            options['cache-dir'], options['restore-add-queue'],
            int(options['queue-width']), endpoint)
        cache.setServiceParent(tickeryService)
        
        root = File('www/output')
        root.putChild('tickery', RegularService(cache, endpoint))
        root.putChild(defaults.TICKERY_CALLBACK_CHILD, callback.Callback(cache))
        
        adminRoot = File('admin/output')
        adminRoot.putChild('tickery', AdminService(cache))
        root.putChild('admin', adminRoot)

        root.putChild('api', API(cache))
        
        factory = server.Site(root)
        if options['promiscuous']:
            kw = {}
        else:
            kw = { 'interface' : 'localhost' }
        tickeryServer = internet.TCPServer(int(options['port']), factory, **kw)
        tickeryServer.setServiceParent(tickeryService)
        
        return tickeryService
Exemplo n.º 2
0
    def makeService(self, options):
        if not options["noisy-logging"]:
            protocol.Factory.noisy = False

        endpoint = twitterEndpoint(options["endpoint"])
        tickeryService = service.MultiService()
        cache = TickeryCache(options["cache-dir"], options["restore-add-queue"], int(options["queue-width"]), endpoint)
        cache.setServiceParent(tickeryService)

        root = File("tickery/www/output")
        root.putChild("tickery", RegularService(cache, endpoint))
        root.putChild(defaults.TICKERY_CALLBACK_CHILD, callback.Callback(cache))

        adminRoot = File("tickery/admin/output")
        adminRoot.putChild("tickery", AdminService(cache))
        root.putChild("admin", adminRoot)

        factory = server.Site(root)
        if options["promiscuous"]:
            kw = {}
        else:
            kw = {"interface": "localhost"}
        tickeryServer = internet.TCPServer(int(options["port"]), factory, **kw)
        tickeryServer.setServiceParent(tickeryService)

        return tickeryService