mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-10-04 16:08:31 +00:00
ini file improvement
This commit is contained in:
@@ -90,6 +90,14 @@ void uwsgi_ini_config(char *file, struct option *long_options) {
|
||||
int lines = 1 ;
|
||||
|
||||
struct option *lopt, *aopt;
|
||||
char *section_asked = "uwsgi";
|
||||
char *colon ;
|
||||
|
||||
colon = strchr(file, ':');
|
||||
if (colon) {
|
||||
colon[0] = 0;
|
||||
section_asked = colon+1 ;
|
||||
}
|
||||
|
||||
fd = open(file, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
@@ -129,7 +137,8 @@ void uwsgi_ini_config(char *file, struct option *long_options) {
|
||||
ini_rstrip(key);
|
||||
if (key[0] != 0) {
|
||||
if (key[0] == '[') {
|
||||
section = key;
|
||||
section = key+1;
|
||||
section[strlen(section)-1] = 0;
|
||||
}
|
||||
else if (key[0] == ';' || key[0] == '#') {
|
||||
// this is a comment
|
||||
@@ -141,7 +150,7 @@ void uwsgi_ini_config(char *file, struct option *long_options) {
|
||||
uwsgi_log("invalid INI record on line %d: %s\n", lines, key);
|
||||
}
|
||||
else {
|
||||
if (!strcmp(section, "[uwsgi]")) {
|
||||
if (!strcmp(section, section_asked)) {
|
||||
ini_rstrip(key);
|
||||
val = ini_lstrip(val);
|
||||
ini_rstrip(val);
|
||||
|
||||
@@ -127,9 +127,21 @@ clear:
|
||||
PyDict_Clear(wsgi_req->async_environ);
|
||||
}
|
||||
if (wsgi_req->async_post && !wsgi_req->fd_closed) {
|
||||
uwsgi_log("CHECK FOR PENDING DATA: %d\n", poll(&wsgi_req->poll, 1, 0));
|
||||
while (poll(&wsgi_req->poll, 1, 0) > 0) {
|
||||
uwsgi_log("data available\n");
|
||||
if (wsgi_req->poll.revents & POLLIN) {
|
||||
read(wsgi_req->poll.fd, wsgi_req->buffer, uwsgi->buffer_size);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
uwsgi_error("poll()");
|
||||
fclose(wsgi_req->async_post);
|
||||
if (!uwsgi->post_buffering || wsgi_req->post_cl <= uwsgi->post_buffering) {
|
||||
wsgi_req->fd_closed = 1 ;
|
||||
|
||||
}
|
||||
}
|
||||
Py_XDECREF((PyObject *)wsgi_req->async_placeholder);
|
||||
|
||||
@@ -280,6 +280,7 @@ void uwsgi_close_request(struct uwsgi_server *uwsgi, struct wsgi_request *wsgi_r
|
||||
|
||||
// close the connection with the webserver
|
||||
if (!wsgi_req->fd_closed) {
|
||||
// TODO discard pending data
|
||||
close(wsgi_req->poll.fd);
|
||||
}
|
||||
uwsgi->workers[0].requests++;
|
||||
|
||||
@@ -850,6 +850,26 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
#ifdef UWSGI_DEBUG
|
||||
int so_bufsize ;
|
||||
socklen_t so_bufsize_len = sizeof(int) ;
|
||||
if (getsockopt(uwsgi.serverfd, SOL_SOCKET, SO_RCVBUF, &so_bufsize, &so_bufsize_len)) {
|
||||
uwsgi_error("getsockopt()");
|
||||
}
|
||||
else {
|
||||
uwsgi_debug("uwsgi socket SO_RCVBUF size: %d\n", so_bufsize);
|
||||
}
|
||||
|
||||
so_bufsize_len = sizeof(int) ;
|
||||
if (getsockopt(uwsgi.serverfd, SOL_SOCKET, SO_SNDBUF, &so_bufsize, &so_bufsize_len)) {
|
||||
uwsgi_error("getsockopt()");
|
||||
}
|
||||
else {
|
||||
uwsgi_debug("uwsgi socket SO_SNDBUF size: %d\n", so_bufsize);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef UWSGI_ASYNC
|
||||
if (uwsgi.async > 1) {
|
||||
#ifdef __linux__
|
||||
|
||||
Reference in New Issue
Block a user