Example #1
0
def run_inbox_callbacks(newpacket, info, status, error_message):
    """
    """
    global _InboxPacketCallbacksList
    if _Debug:
        lg.out(
            _DebugLevel,
            'callback.run_inbox_callbacks for %s from %s' % (newpacket, info))
    handled = False
    for cb in _InboxPacketCallbacksList:
        try:
            _ok = cb(newpacket, info, status, error_message)
            if _ok:
                handled = True
        except:
            lg.exc()
            continue
        if not handled:
            if _Debug:
                lg.out(_DebugLevel, '    passed by %s' % lg.fqn(cb))
            continue
        if _Debug:
            lg.out(_DebugLevel, '    handled by %s' % lg.fqn(cb))
        break
    return handled
Example #2
0
def run_outbox_callbacks(pkt_out):
    """
    """
    global _OutboxPacketCallbacksList
    if _Debug:
        lg.out(_DebugLevel, 'callback.run_outbox_callbacks for %s' % pkt_out)
        # lg.out(_DebugLevel, '    %s' % _OutboxPacketCallbacksList)
    handled = False
    for cb in _OutboxPacketCallbacksList:
        try:
            if cb(pkt_out):
                handled = True
        except:
            lg.exc()
        if not handled:
            if _Debug:
                lg.out(_DebugLevel, '    passed by %s' % lg.fqn(cb))
            continue
        if _Debug:
            lg.out(_DebugLevel, '    handled by %s' % lg.fqn(cb))
        break
    return handled