Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def init(self):
"""initialize the plugin."""
opt = dotdict(id=self.pid, secret=self.secret)
self.conn = PluginConnection(self, opt)
self.conn.setup()
self.terminated = False
initialized = self.loop.create_future()
self.on_plugin_message("initialized", initialized)
self.on_plugin_message("disconnected", self.terminate)
await initialized
workers = [
self.message_worker(self.janus_queue.async_q, self.conn.abort)
for i in range(2)
]
asyncio.ensure_future(asyncio.gather(*workers))
async def init(self):
"""initialize the plugin."""
opt = dotdict(id=self.pid, secret=self.secret)
self.conn = PluginConnection(opt, client=self)
self.terminated = False
initialized = self.loop.create_future()
self.on_plugin_message("initialized", initialized)
self.on_plugin_message("disconnected", self.terminate)
await initialized
workers = [
self.message_worker(self.janus_queue.async_q, self.conn.abort)
for i in range(2)
]
asyncio.ensure_future(asyncio.gather(*workers))
)
parser.add_argument("--daemon", action="store_true", help="daemon mode")
parser.add_argument("--debug", action="store_true", help="debug mode")
opt = parser.parse_args()
logging.basicConfig(stream=sys.stdout)
logger.setLevel(logging.INFO)
if opt.debug:
logger.setLevel(logging.DEBUG)
if PYTHON34:
client = AsyncClient()
else:
client = Client()
plugin_conn = PluginConnection(client, opt)
plugin_conn.start()
def add_plugin(plugin_id, client_id):
opt = dotdict(id=plugin_id, secret="", work_dir="")
client = BaseClient.get_client(client_id)
p = PluginConnection(client, opt)
return p
def get_plugin(plugin_id):
return PluginConnection._registered_plugins.get(plugin_id)