@Session
    @SMPPClientConfigUpdate
    @defer.inlineCallbacks
    def update_session(self, updateLog):
        connector = self.pb['smppcm'].getConnector(self.sessionContext['cid'])
        connectorDetails = self.pb['smppcm'].getConnectorDetails(self.sessionContext['cid'])
        for key, value in updateLog.iteritems():
            connector['config'].set(key, value)

        if connector['config'].PendingRestart and connectorDetails['service_status'] == 1:
            self.protocol.sendData(
                'Restarting connector [%s] for updates to take effect ...' % self.sessionContext['cid'],
                prompt=False)
            st = yield self.pb['smppcm'].perspective_connector_stop(self.sessionContext['cid'])
            if not st:
                self.protocol.sendData('Failed stopping connector, check log for details', prompt=False)
            else:
                st = yield self.pb['smppcm'].perspective_connector_start(self.sessionContext['cid'])
                if not st:
                    self.protocol.sendData(
                        'Failed starting connector, will retry in 5 seconds', prompt=False)

                    # Wait before start retrial
                    exitDeferred = defer.Deferred()
                    reactor.callLater(5, exitDeferred.callback, None)
                    yield exitDeferred

                    st = yield self.pb['smppcm'].perspective_connector_start(self.sessionContext['cid'])
                    if not st:
                        self.protocol.sendData('Permanently failed starting connector !', prompt=False)

        self.protocol.sendData(
            'Successfully updated connector [%s]' % self.sessionContext['cid'], prompt=False)
        self.stopSession()
dataset/ETHPy150Open jookies/jasmin/jasmin/protocols/cli/smppccm.py/SmppCCManager.update_session/original