Ejemplo n.º 1
0
def dmproc_consume(state):
    s = state.get("dmproc")[0]
    while ("dmproc" in state):
        r = select.select([s.fileno()], [], [], 1)[0]
        if (len(r) == 1):
            frame = helpers.recv_frame(s)
            if (frame is None):
                break
            else:
                state["dmproc"][2].append(make_events_relative(frame))
Ejemplo n.º 2
0
def dmproc_consume(state):
    s = state.get("dmproc")[0]
    while ("dmproc" in state):
        r = select.select([s.fileno()], [], [], 1)[0]
        if (len(r) == 1):
            frame = helpers.recv_frame(s)
            if (frame is None):
                break
            else:
                state["dmproc"][2].append(make_events_relative(frame))
Ejemplo n.º 3
0
def dmproc_connect(opts, state, proc):
    s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM, 0)
    s.connect(opts.config.get("xmpp", "dmproc"))
    helpers.send_frame(s, proc)
    status = helpers.recv_frame(s)
    if (status == "status 0;"):
        t = threading.Thread(target=dmproc_consume, args=(state, ))
        state["dmproc"] = (s, t, [])
        t.start()
        return (0)
    else:
        return (1)
Ejemplo n.º 4
0
def dmproc_connect(opts, state, proc):
    s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM, 0)
    s.connect(opts.config.get("xmpp", "dmproc"))
    helpers.send_frame(s, proc)
    status = helpers.recv_frame(s)
    if (status == "status 0;"):
        t = threading.Thread(target=dmproc_consume, args=(state,))
        state["dmproc"] = (s, t, [])
        t.start()
        return(0)
    else:
        return(1)