Ejemplo n.º 1
0
    def run(self):
        from twisted.internet import reactor
        from twisted.plugins.ipv8_plugin import Options, service_maker

        options = Options()
        Options.parseOptions(options,
                             os.getenv('PYTHON_SERVICE_ARGUMENT', '').split())
        service_maker.makeService(options)
        print "WILL RUN SERVICE"
        reactor.run()
Ejemplo n.º 2
0
                self.overlays = [
                    overlay for overlay in self.overlays if overlay != instance
                ]
                self.strategies = [(strategy, target_peers)
                                   for (strategy,
                                        target_peers) in self.strategies
                                   if strategy.overlay != instance]
                return maybeDeferred(instance.unload)

        @inlineCallbacks
        def stop(self, stop_reactor=True):
            self.state_machine_lc.stop()
            with self.overlay_lock:
                unload_list = [
                    self.unload_overlay(overlay)
                    for overlay in self.overlays[:]
                ]
                yield DeferredList(unload_list)
                yield self.endpoint.close()
            if stop_reactor:
                reactor.callFromThread(reactor.stop)


if __name__ == '__main__':
    from twisted.plugins.ipv8_plugin import Options, service_maker

    options = Options()
    Options.parseOptions(options, sys.argv[1:])
    service_maker.makeService(options)
    reactor.run()