示例#1
0
def run_module_run(run_func, skull_txn):
    try:
        txn = Txn.Txn(skull_txn)
        ret = run_func(txn)

        txn.storeMsgData()
        return ret
    except Exception as e:
        return False
示例#2
0
def run_module_pack(pack_func, skull_txn, skull_txndata):
    txn = Txn.Txn(skull_txn)
    txndata = TxnData.TxnData(skull_txndata)

    try:
        pack_func(txn, txndata)
    except Exception as e:
        print "Failed to run_module_pack: {}".format(e)
    finally:
        txn.destroyMsgData()
示例#3
0
def run_module_pack(pack_func, skull_txn, skull_txndata):
    txn = Txn.Txn(skull_txn)
    txndata = TxnData.TxnData(skull_txndata)

    try:
        pack_func(txn, txndata)
    except Exception as e:
        Logger.error(
            'module_pack', 'module_pack failed due to: {}'.format(e),
            'Please check the logic why return False or Exception occurred')
    finally:
        txn.destroyMsgData()
示例#4
0
def run_module_run(run_func, skull_txn):
    try:
        txn = Txn.Txn(skull_txn)
        ret = run_func(txn)

        txn.storeMsgData()
        return ret
    except Exception as e:
        Logger.error(
            'module_run', 'module_run failed due to: {}'.format(e),
            'Please check the logic why return False or Exception occurred')
        return False
示例#5
0
def run_module_unpack(unpack_func, skull_txn, data):
    txn = Txn.Txn(skull_txn)

    try:
        consumed_length = unpack_func(txn, data)
        txn.storeMsgData()

        if consumed_length is None:
            return -1

        return int(consumed_length)
    except Exception as e:
        return -1  # Error occurred
示例#6
0
def run_module_unpack(unpack_func, skull_txn, data):
    txn = Txn.Txn(skull_txn)

    try:
        consumed_length = unpack_func(txn, data)
        txn.storeMsgData()

        if consumed_length is None:
            return -1

        return int(consumed_length)
    except Exception as e:
        Logger.error(
            'module_unpack', 'module_unpack failed due to: {}'.format(e),
            'Please check the logic why return False or Exception occurred')
        return -1  # Error occurred