def _discoro_process(_discoro_config, _discoro_server_id, _discoro_mp_queue, _discoro_auth):
    import os
    import logging
    import asyncoro.disasyncoro as asyncoro

    if _discoro_config['loglevel']:
        asyncoro.logger.setLevel(logging.DEBUG)
    else:
        asyncoro.logger.setLevel(logging.INFO)
    del _discoro_config['loglevel']

    _discoro_config_msg = {'req': 'config', 'id': _discoro_server_id,
                           'phoenix': _discoro_config.pop('phoenix', False),
                           'serve': _discoro_config.pop('serve', -1),
                           'peers': _discoro_config.pop('peers', []),
                           'min_pulse_interval': _discoro_config.pop('min_pulse_interval'),
                           'max_pulse_interval': _discoro_config.pop('max_pulse_interval'),
                           'auth': _discoro_auth, 'mp_queue': _discoro_mp_queue}
    _discoro_scheduler = asyncoro.AsynCoro(**_discoro_config)
    _discoro_coro = asyncoro.Coro(_discoro_proc)
    # delete variables created in main
    for _discoro_var in globals().keys():
        if _discoro_var.startswith('_discoro_'):
            globals().pop(_discoro_var)

    del logging, os, _discoro_config, _discoro_var

    req_queue, _discoro_mp_queue = _discoro_mp_queue, None

    while 1:
        try:
            req = req_queue.get()
        except __HOLE__:
            req = {'req': 'terminate', 'auth': _discoro_auth}
            req_queue.put(req)
            asyncoro.logger.debug('%s terminating', asyncoro.AsynCoro.instance()._location)

        if not isinstance(req, dict) or req.get('auth') != _discoro_auth:
            asyncoro.logger.warning('Ignoring invalid request: "%s"', type(req))
            continue

        cmd = req.get('req')
        if cmd == 'status' or cmd == 'close':
            _discoro_coro.send(req)
        elif cmd == 'start':
            _discoro_config_msg['timer_coro'] = req.get('timer_coro', None)
            _discoro_coro.send(_discoro_config_msg)
            del _discoro_config_msg
        elif cmd == 'quit' or cmd == 'terminate':
            _discoro_coro.send(req)
            break

    _discoro_scheduler.finish()
dataset/ETHPy150Open pgiri/asyncoro/py2/asyncoro/discoronode.py/_discoro_process