mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-06-16 02:15:48 +00:00
added a skel hook for waiting for 2 file descriptors
This commit is contained in:
@@ -171,6 +171,7 @@ void uwsgi_init_default() {
|
||||
uwsgi.wait_read_hook = uwsgi_simple_wait_read_hook;
|
||||
uwsgi.wait_write_hook = uwsgi_simple_wait_write_hook;
|
||||
uwsgi.wait_milliseconds_hook = uwsgi_simple_wait_milliseconds_hook;
|
||||
uwsgi.wait_read2_hook = uwsgi_simple_wait_read2_hook;
|
||||
|
||||
uwsgi_websockets_init();
|
||||
|
||||
|
||||
@@ -24,6 +24,39 @@ int uwsgi_simple_wait_read_hook(int fd, int timeout) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int uwsgi_simple_wait_read2_hook(int fd0, int fd1, int timeout, int *fd) {
|
||||
struct pollfd upoll[2];
|
||||
timeout = timeout * 1000;
|
||||
|
||||
upoll[0].fd = fd0;
|
||||
upoll[0].events = POLLIN;
|
||||
upoll[0].revents = 0;
|
||||
|
||||
upoll[0].fd = fd0;
|
||||
upoll[0].events = POLLIN;
|
||||
upoll[0].revents = 0;
|
||||
|
||||
int ret = poll(upoll, 2, timeout);
|
||||
|
||||
if (ret > 0) {
|
||||
if (upoll[0].revents & POLLIN) {
|
||||
*fd = fd0;
|
||||
return 1;
|
||||
}
|
||||
if (upoll[1].revents & POLLIN) {
|
||||
*fd = fd1;
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
if (ret < 0) {
|
||||
uwsgi_error("uwsgi_simple_wait_read_hook2()/poll()");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
seek()/rewind() language-independent implementations.
|
||||
*/
|
||||
|
||||
@@ -2606,6 +2606,7 @@ struct uwsgi_server {
|
||||
int (*wait_write_hook) (int, int);
|
||||
int (*wait_read_hook) (int, int);
|
||||
int (*wait_milliseconds_hook) (int);
|
||||
int (*wait_read2_hook) (int, int, int, int *);
|
||||
|
||||
struct uwsgi_string_list *schemes;
|
||||
|
||||
@@ -4195,6 +4196,7 @@ struct uwsgi_buffer *uwsgi_proto_base_add_header(struct wsgi_request *, char *,
|
||||
|
||||
int uwsgi_simple_wait_write_hook(int, int);
|
||||
int uwsgi_simple_wait_read_hook(int, int);
|
||||
int uwsgi_simple_wait_read2_hook(int, int, int, int *);
|
||||
int uwsgi_simple_wait_milliseconds_hook(int);
|
||||
int uwsgi_response_write_headers_do(struct wsgi_request *);
|
||||
char *uwsgi_request_body_read(struct wsgi_request *, ssize_t , ssize_t *);
|
||||
|
||||
Reference in New Issue
Block a user