def _close_internal(identity, msg): """Send a kill signal to the greenlet specified by identity. Used for closing connections on BPClose messages. """ g = greenlet.get_identity_greenlet(identity) if g is not None: g.kill(timeout=1, block=True, exception=greenlet.BPGreenletExit)
def kill_claims(identity): """Kill all plugin claims for a certain client identity. Used when a client disconnects from the router.""" if identity not in _ctd: logging.warning("No client %s is known to claim a device!", identity) return for dev_id in _ctd[identity]: g = greenlet.get_identity_greenlet(dev_id) if g is None: logging.warning("Device %s is not bound to client %s", dev_id, identity) continue g.kill(exception=greenlet.BPGreenletExit, timeout=1, block=True)