Пример #1
0
 def close(self):
     """Disconnects uWSGI from the client."""
     uwsgi.disconnect()
     if self._req_ctx is None:
         # better kill it here in case wait() is not called again
         self._select_greenlet.kill()
         self._event.set()
Пример #2
0
 def close(self):
     """Disconnects uWSGI from the client."""
     uwsgi.disconnect()
     if self._req_ctx is None:
         # better kill it here in case wait() is not called again
         self._select_greenlet.kill()
         self._event.set()
Пример #3
0
    def cleanup(self):
        if self.fd_select_job:
            self.fd_select_job.kill()
        logger.info(f'<Client {self.id}> Websocket connection lost.')
        uwsgi.disconnect()
        if self.state == ClientState.suspended:
            # wait an amount of time to be picked up for resume
            self.merge_event.wait(60.0)

        if self.state == ClientState.merged:
            logger.info(
                f'<Client {self.id}> Merging websocket session to resume.')
        else:
            logger.info(f'<Client {self.id}> Websocket session killed.')

        self.on_kill()
Пример #4
0
    else:
        fd = args[0]
        l = args[1]
    data = ffi.new('char[%d]' % l)
    rlen = libc.read(fd, data, l)
    if rlen <= 0:
        raise IOError("unable to receive data")
    return ffi.string(data[0:rlen])


uwsgi.recv = uwsgi_pypy_recv
"""
uwsgi.close(fd)
"""
uwsgi.close = lambda fd: lib.close(fd)
"""
uwsgi.disconnect()
"""
uwsgi.disconnect = lambda: lib.uwsgi_disconnect(uwsgi_pypy_current_wsgi_req())


def uwsgi_pypy_websocket_recv():
    """
    uwsgi.websocket_recv()
    """
    wsgi_req = uwsgi_pypy_current_wsgi_req()
    ub = lib.uwsgi_websocket_recv(wsgi_req)
    if ub == ffi.NULL:
        raise IOError("unable to receive websocket message")
    ret = ffi.buffer(ub.buf, ub.pos)[:]
    lib.uwsgi_buffer_destroy(ub)
Пример #5
0
        l = args[1]
    data = ffi.new("char[%d]" % l)
    rlen = libc.read(fd, data, l)
    if rlen <= 0:
        raise IOError("unable to receive data")
    return ffi.string(data[0:rlen])


uwsgi.recv = uwsgi_pypy_recv

"""
uwsgi.close(fd)
"""
uwsgi.close = lambda fd: lib.close(fd)

"""
uwsgi.disconnect()
"""
uwsgi.disconnect = lambda: lib.uwsgi_disconnect(uwsgi_pypy_current_wsgi_req())


def uwsgi_pypy_websocket_recv():
    """
    uwsgi.websocket_recv()
    """
    wsgi_req = uwsgi_pypy_current_wsgi_req()
    ub = lib.uwsgi_websocket_recv(wsgi_req)
    if ub == ffi.NULL:
        raise IOError("unable to receive websocket message")
    ret = ffi.buffer(ub.buf, ub.pos)[:]
    lib.uwsgi_buffer_destroy(ub)