mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-07 14:11:46 +00:00
I add this feature for using uwsgi websocket with gevent more easy and
convenient. Example: tests/websockets_chat_2.py Add: add a new API `uwsgi.input_object()` for get `struct wsgi_req *` in python. Modify: `uwsgi.websocket_send/send_binary/recv/recv_nb` now has a kwarg: `uwsgi_input`. If not provide the `uwsgi_input` keyword argument, The four function's behavior not changed. When provide the `uwsgi_input` keyword argument, The four function will get `wsgi_req` from the argument. In this way, uwsgi websocket functions can be used in other greenlets.
This commit is contained in:
@@ -100,6 +100,19 @@ typedef struct uwsgi_Input {
|
||||
struct wsgi_request *wsgi_req;
|
||||
} uwsgi_Input;
|
||||
|
||||
|
||||
// this struct is used for:
|
||||
// get this object in python,
|
||||
// and pass back to uwsgi.
|
||||
// uwsgi verify whether this is a valid `struct wsgi_request *` pointer
|
||||
typedef struct uwsgi_InputIdentity {
|
||||
PyObject_HEAD
|
||||
int mywid;
|
||||
uint64_t requests;
|
||||
struct wsgi_request *wsgi_req;
|
||||
} uwsgi_InputIdentity;
|
||||
|
||||
|
||||
struct uwsgi_python {
|
||||
|
||||
char *home;
|
||||
@@ -307,6 +320,8 @@ void uwsgi_python_set_thread_name(int);
|
||||
return PyErr_Format(PyExc_SystemError, "you can call uwsgi api function only from the main callable");\
|
||||
}
|
||||
|
||||
struct wsgi_request *py_current_wsgi_req_from_input(PyObject *);
|
||||
|
||||
#define uwsgi_pyexit {PyErr_Print();exit(1);}
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
Reference in New Issue
Block a user