@defer.inlineCallbacks
    def perspective_connector_stop(self, cid, delQueues=False):

        self.log.debug('Stopping connector [%s]', cid)

        connector = self.getConnector(cid)
        if connector is None:
            self.log.error('Trying to stop a connector with an unknown cid: %s', cid)
            defer.returnValue(False)

        # Stop the queue consumer
        if connector['consumer_tag'] is not None:
            self.log.debug('Stopping submit_sm_q consumer in connector [%s]', cid)
            yield self.amqpBroker.chan.basic_cancel(consumer_tag=connector['consumer_tag'])

            # Cleaning
            self.log.debug('Cleaning objects in connector [%s]', cid)
            connector['submit_sm_q'] = None
            connector['consumer_tag'] = None

        if connector['service'].running == 0:
            self.log.error('Connector [%s] is already stopped.', cid)
            defer.returnValue(False)

        if delQueues:
            submitSmQueueName = 'submit.sm.%s' % cid
            self.log.debug('Deleting queue [%s]', submitSmQueueName)
            yield self.amqpBroker.chan.queue_delete(queue=submitSmQueueName)

        # Reject & requeue any pending message to avoid loosing messages after
        # clearing timers
        if len(connector['sm_listener'].rejectTimers) > 0:
            for msgid, timer in connector['sm_listener'].rejectTimers.items():
                if timer.active():
                    func = timer.func
                    kw = timer.kw
                    timer.cancel()
                    del connector['sm_listener'].rejectTimers[msgid]

                    self.log.debug('Rejecting/requeuing msgid [%s] before stopping connector', msgid)
                    yield func(**kw)

        # Stop timers in message listeners
        self.log.debug('Clearing sm_listener timers in connector [%s]', cid)
        connector['sm_listener'].clearAllTimers()
        connector['sm_listener'].submit_sm_q = None

        # Stop SMPP connector
        connector['service'].stopService()

        self.log.info('Stopped connector [%s]', cid)

        # Set persistance state to False (pending for persistance)
        self.persisted = False

        defer.returnValue(True)
Traverse a tree or a graph based at 'node' and generate a sequence
dataset/ETHPy150Open jookies/jasmin/jasmin/managers/clients.py/SMPPClientManagerPB.perspective_connector_stop--crossover with--dataset/ETHPy150Open tow/sunburnt/sunburnt/walktree.py/walk