mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-10-05 16:38:22 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ef7819080 | ||
|
|
319ad13af2 | ||
|
|
fe28e90ae3 | ||
|
|
f604a0a533 | ||
|
|
4ab78d42a3 | ||
|
|
c631e7dae6 | ||
|
|
da8e88d638 | ||
|
|
4707d9250d | ||
|
|
d719960411 | ||
|
|
734818c995 | ||
|
|
a35335a820 | ||
|
|
aca4dbfbe7 | ||
|
|
b036029b32 | ||
|
|
52f3e757ed | ||
|
|
c4ce1cf7d8 | ||
|
|
48175d0759 | ||
|
|
2932168db7 |
@@ -44,3 +44,6 @@ a3ca2e8e27c5c12c44ba0cacb4de4cb51377f184 1.0-rc7
|
||||
af490b8c30f83bc5fb6f3837a760981474647755 1.0-rc10
|
||||
3c70927335856883283fe4db448e092cecc0ccdb 1.0
|
||||
8fe7bb792399cb6e6a24e20551f4149409660363 1.0.1
|
||||
1d1702789710ec1c20613d2490b14f70756e67ec 1.1-rc1
|
||||
901f0cb5de36ea907b26d64ac9ce54605ec531d2 1.1-rc2
|
||||
ede5c664978bb40e476e8d4a5789562928f28507 1.1-rc3
|
||||
|
||||
@@ -395,6 +395,10 @@ void emperor_add(char *name, time_t born, char *config, uint32_t config_size, ui
|
||||
|
||||
// close all of the unneded fd
|
||||
for(i=3;i<(int)uwsgi.max_fd;i++) {
|
||||
if (n_ui->use_config) {
|
||||
if (i == n_ui->pipe_config[1])
|
||||
continue;
|
||||
}
|
||||
if (i != n_ui->pipe[1]) {
|
||||
close(i);
|
||||
}
|
||||
@@ -653,7 +657,9 @@ reconnect:
|
||||
ssize_t rlen = read(interesting_fd, &byte, 1);
|
||||
if (rlen <= 0) {
|
||||
// SAFE
|
||||
emperor_del(ui_current);
|
||||
if (!ui_current->config_len) {
|
||||
emperor_del(ui_current);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (byte == 17) {
|
||||
|
||||
@@ -107,6 +107,7 @@ struct uwsgi_gateway_socket *uwsgi_new_gateway_socket(char *name, char *owner) {
|
||||
|
||||
memset(uwsgi_sock, 0, sizeof(struct uwsgi_gateway_socket));
|
||||
uwsgi_sock->fd = -1;
|
||||
uwsgi_sock->shared = 0;
|
||||
uwsgi_sock->name = name;
|
||||
uwsgi_sock->owner = owner;
|
||||
|
||||
|
||||
@@ -164,7 +164,9 @@ char *uwsgi_amqp_consume(int fd, uint64_t *msgsize, char **routing_key) {
|
||||
ptr = amqp_get_longlong(ptr, watermark, msgsize); if (!ptr) goto clear2;
|
||||
|
||||
free(frame);
|
||||
frame = NULL;
|
||||
free(header);
|
||||
header = NULL;
|
||||
|
||||
char *fullbody = uwsgi_malloc(*msgsize);
|
||||
char *message;
|
||||
|
||||
@@ -17,6 +17,7 @@ static void uwsgi_corerouter_setup_sockets(char *gw_id) {
|
||||
int shared_socket = atoi(ugs->name+1);
|
||||
if (shared_socket >= 0) {
|
||||
ugs->fd = uwsgi_get_shared_socket_fd_by_num(shared_socket);
|
||||
ugs->shared = 1;
|
||||
if (ugs->fd == -1) {
|
||||
uwsgi_log("unable to use shared socket %d\n", shared_socket);
|
||||
exit(1);
|
||||
|
||||
@@ -24,7 +24,7 @@ static struct uwsgi_lock_item *uwsgi_register_lock(char *id, int rw) {
|
||||
if (!uli->next) {
|
||||
uli->next = uwsgi_malloc_shared(sizeof(struct uwsgi_lock_item));
|
||||
if (rw) {
|
||||
uwsgi_malloc_shared(uwsgi.rwlock_size);
|
||||
uli->next->lock_ptr = uwsgi_malloc_shared(uwsgi.rwlock_size);
|
||||
}
|
||||
else {
|
||||
uli->next->lock_ptr = uwsgi_malloc_shared(uwsgi.lock_size);
|
||||
@@ -159,6 +159,7 @@ struct uwsgi_lock_item *uwsgi_rwlock_fast_init(char *id) {
|
||||
uwsgi_log("unable to allocate rwlock structure\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (pthread_rwlockattr_setpshared(&attr, PTHREAD_PROCESS_SHARED)) {
|
||||
uwsgi_log("unable to share rwlock\n");
|
||||
exit(1);
|
||||
@@ -296,25 +297,38 @@ void uwsgi_rwunlock_fast(struct uwsgi_lock_item *uli) { uwsgi_unlock_fast(uli);
|
||||
|
||||
#endif
|
||||
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/sem.h>
|
||||
|
||||
struct uwsgi_lock_item *uwsgi_lock_ipcsem_init(char *id) {
|
||||
|
||||
// used by ftok
|
||||
static int counter = 1;
|
||||
union semun {
|
||||
int val;
|
||||
struct semid_ds *buf;
|
||||
ushort *array;
|
||||
} semu ;
|
||||
int semid;
|
||||
key_t myKey;
|
||||
|
||||
struct uwsgi_lock_item *uli = uwsgi_register_lock(id, 0);
|
||||
|
||||
int semid = semget(IPC_PRIVATE, 1, IPC_CREAT|IPC_EXCL| 0600);
|
||||
if (uwsgi.ftok) {
|
||||
myKey = ftok(uwsgi.ftok, counter);
|
||||
if (myKey < 0) {
|
||||
uwsgi_error("ftok()");
|
||||
exit(1);
|
||||
}
|
||||
counter++;
|
||||
semid = semget(myKey, 1, IPC_CREAT|0666);
|
||||
}
|
||||
else {
|
||||
semid = semget(IPC_PRIVATE, 1, IPC_CREAT|IPC_EXCL| 0666);
|
||||
}
|
||||
|
||||
if (semid < 0) {
|
||||
uwsgi_error("semget()");
|
||||
exit(1);
|
||||
}
|
||||
// do this now, to allows triggering fo atexit hook in case of problems
|
||||
// do this now, to allows triggering of atexit hook in case of problems
|
||||
memcpy(uli->lock_ptr, &semid, sizeof(int));
|
||||
|
||||
semu.val = 1;
|
||||
@@ -377,6 +391,8 @@ void uwsgi_ipcsem_clear(void) {
|
||||
|
||||
if (uwsgi.master_process && getpid() == uwsgi.workers[0].pid) goto clear;
|
||||
|
||||
if (!uwsgi.master_process && uwsgi.mywid == 1) goto clear;
|
||||
|
||||
return;
|
||||
|
||||
clear:
|
||||
|
||||
@@ -59,7 +59,7 @@ void *simple_loop(void *arg1) {
|
||||
sigdelset(&smask, SIGSEGV);
|
||||
#endif
|
||||
pthread_sigmask(SIG_BLOCK, &smask, NULL);
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->init_thread) {
|
||||
uwsgi.p[i]->init_thread(core_id);
|
||||
}
|
||||
@@ -135,7 +135,7 @@ void *zeromq_loop(void *arg1) {
|
||||
sigdelset(&smask, SIGSEGV);
|
||||
#endif
|
||||
pthread_sigmask(SIG_BLOCK, &smask, NULL);
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->init_thread) {
|
||||
uwsgi.p[i]->init_thread(core_id);
|
||||
}
|
||||
|
||||
@@ -579,7 +579,7 @@ int master_loop(char **argv, char **environ) {
|
||||
uwsgi.gp[i]->master_cycle();
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->master_cycle) {
|
||||
uwsgi.p[i]->master_cycle();
|
||||
}
|
||||
@@ -918,7 +918,7 @@ int master_loop(char **argv, char **environ) {
|
||||
|
||||
// loop the various udp manager until one returns true
|
||||
udp_managed = 0;
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->manage_udp) {
|
||||
if (uwsgi.p[i]->manage_udp(udp_client_addr, udp_client.sin_port, uwsgi.wsgi_req->buffer, rlen)) {
|
||||
udp_managed = 1;
|
||||
|
||||
+5
-2
@@ -371,7 +371,10 @@ void uwsgi_fixup_fds(int wid, int muleid, struct uwsgi_gateway *ug) {
|
||||
ugs = ugs->next;
|
||||
continue;
|
||||
}
|
||||
close(ugs->fd);
|
||||
// do not close shared sockets !!!
|
||||
if (!ugs->shared) {
|
||||
close(ugs->fd);
|
||||
}
|
||||
ugs = ugs->next;
|
||||
}
|
||||
// fix the communication pipe
|
||||
@@ -475,7 +478,7 @@ int uwsgi_respawn_worker(int wid) {
|
||||
|
||||
if (uwsgi.master_process) {
|
||||
if ((uwsgi.workers[uwsgi.mywid].respawn_count || uwsgi.cheap)) {
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->master_fixup) {
|
||||
uwsgi.p[i]->master_fixup(1);
|
||||
}
|
||||
|
||||
@@ -48,13 +48,13 @@ void uwsgi_mule(int id) {
|
||||
|
||||
uwsgi_close_all_sockets();
|
||||
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->master_fixup) {
|
||||
uwsgi.p[i]->master_fixup(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->post_fork) {
|
||||
uwsgi.p[i]->post_fork();
|
||||
}
|
||||
@@ -62,7 +62,7 @@ void uwsgi_mule(int id) {
|
||||
|
||||
|
||||
if (uwsgi.mules[id-1].patch) {
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->mule) {
|
||||
if (uwsgi.p[i]->mule(uwsgi.mules[id-1].patch) == 1) {
|
||||
// never here
|
||||
@@ -184,7 +184,7 @@ void uwsgi_mule_handler() {
|
||||
}
|
||||
else {
|
||||
int i,found = 0;
|
||||
for(i=0;i<0xff;i++) {
|
||||
for(i=0;i<256;i++) {
|
||||
if (uwsgi.p[i]->mule_msg) {
|
||||
if (uwsgi.p[i]->mule_msg(message, len)) {
|
||||
found = 1;
|
||||
|
||||
@@ -5,7 +5,7 @@ extern struct uwsgi_server uwsgi;
|
||||
static int plugin_already_loaded(const char *plugin) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->name) {
|
||||
if (!strcmp(plugin, uwsgi.p[i]->name)) {
|
||||
#ifdef UWSGI_DEBUG
|
||||
|
||||
@@ -12,6 +12,7 @@ struct uwsgi_cgi {
|
||||
struct uwsgi_string_list *unset;
|
||||
struct uwsgi_string_list *loadlib;
|
||||
int optimize;
|
||||
int from_docroot;
|
||||
int has_mountpoints;
|
||||
struct uwsgi_dyn_dict *default_cgi;
|
||||
int path_info;
|
||||
@@ -45,6 +46,8 @@ struct uwsgi_option uwsgi_cgi_options[] = {
|
||||
{"cgi-map-helper", required_argument, 0, "add a cgi map-helper", uwsgi_opt_add_cgi_maphelper, NULL, 0},
|
||||
{"cgi-helper", required_argument, 0, "add a cgi map-helper", uwsgi_opt_add_cgi_maphelper, NULL, 0},
|
||||
|
||||
{"cgi-from-docroot", no_argument, 0, "blindly enable cgi in DOCUMENT_ROOT", uwsgi_opt_true, &uc.from_docroot, 0},
|
||||
|
||||
{"cgi-buffer-size", required_argument, 0, "set cgi buffer size", uwsgi_opt_set_64bit, &uc.buffer_size, 0},
|
||||
{"cgi-timeout", required_argument, 0, "set cgi script timeout", uwsgi_opt_set_int, &uc.timeout, 0},
|
||||
|
||||
@@ -500,16 +503,23 @@ int uwsgi_cgi_request(struct wsgi_request *wsgi_req) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
char *docroot = NULL;
|
||||
|
||||
// check for file availability (and 'runnability')
|
||||
if (uc.from_docroot) {
|
||||
docroot = wsgi_req->document_root;
|
||||
docroot_len = wsgi_req->document_root_len;
|
||||
}
|
||||
else {
|
||||
docroot = uwsgi_cgi_get_docroot(wsgi_req->path_info, wsgi_req->path_info_len, &need_free, &is_a_file, &discard_base, &script_name);
|
||||
docroot_len = strlen(docroot);
|
||||
}
|
||||
|
||||
char *docroot = uwsgi_cgi_get_docroot(wsgi_req->path_info, wsgi_req->path_info_len, &need_free, &is_a_file, &discard_base, &script_name);
|
||||
|
||||
if (docroot == NULL) {
|
||||
if (docroot == NULL || docroot_len == 0) {
|
||||
uwsgi_cgi_404(wsgi_req);
|
||||
return UWSGI_OK;
|
||||
}
|
||||
|
||||
docroot_len = strlen(docroot);
|
||||
memcpy(full_path, docroot, docroot_len);
|
||||
|
||||
if (!is_a_file) {
|
||||
|
||||
@@ -16,7 +16,7 @@ struct uwsgi_lua {
|
||||
|
||||
struct uwsgi_option uwsgi_lua_options[] = {
|
||||
|
||||
{"lua", required_argument, 0, "load lua wsapi app", uwsgi_opt_set_str, &uwsgi.ulua.filename, 0},
|
||||
{"lua", required_argument, 0, "load lua wsapi app", uwsgi_opt_set_str, &ulua.filename, 0},
|
||||
|
||||
{0, 0, 0, 0},
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "../../uwsgi.h"
|
||||
|
||||
int uwsgi_request_notfound(struct wsgi_request *wsgi_req) {
|
||||
|
||||
struct iovec iov[3];
|
||||
|
||||
if (wsgi_req->protocol_len > 0) {
|
||||
iov[0].iov_base = wsgi_req->protocol;
|
||||
iov[0].iov_len = wsgi_req->protocol_len;
|
||||
}
|
||||
else {
|
||||
iov[0].iov_base = "HTTP/1.0";
|
||||
iov[0].iov_len = 8;
|
||||
}
|
||||
|
||||
iov[1].iov_base = " 404 Not Found\r\n";
|
||||
iov[1].iov_len = 16;
|
||||
|
||||
iov[2].iov_base = "Content-Type: text/plain\r\n\r\n";
|
||||
iov[2].iov_len = 28;
|
||||
|
||||
wsgi_req->headers_size = wsgi_req->socket->proto_writev_header(wsgi_req, iov, 3);
|
||||
|
||||
wsgi_req->response_size = wsgi_req->socket->proto_write(wsgi_req, "Not Found", 9);
|
||||
wsgi_req->status = 404;
|
||||
|
||||
return UWSGI_OK;
|
||||
}
|
||||
|
||||
|
||||
struct uwsgi_plugin notfound_plugin = {
|
||||
|
||||
.name = "notfound",
|
||||
.request = uwsgi_request_notfound,
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
NAME='notfound'
|
||||
|
||||
CFLAGS = []
|
||||
LDFLAGS = []
|
||||
LIBS = []
|
||||
GCC_LIST = ['notfound']
|
||||
@@ -299,15 +299,11 @@ static sapi_module_struct uwsgi_sapi_module;
|
||||
void uwsgi_php_set(char *opt) {
|
||||
|
||||
uwsgi_sapi_module.ini_entries = realloc(uwsgi_sapi_module.ini_entries, uphp.ini_size + strlen(opt)+2);
|
||||
if (uphp.ini_size == 0) {
|
||||
memcpy(uwsgi_sapi_module.ini_entries, opt, strlen(opt));
|
||||
}
|
||||
else {
|
||||
memcpy(uwsgi_sapi_module.ini_entries + (uphp.ini_size -1), opt, strlen(opt));
|
||||
}
|
||||
uphp.ini_size += strlen(opt)+2;
|
||||
uwsgi_sapi_module.ini_entries[uphp.ini_size-2] = '\n';
|
||||
uwsgi_sapi_module.ini_entries[uphp.ini_size-1] = 0;
|
||||
memcpy(uwsgi_sapi_module.ini_entries + uphp.ini_size, opt, strlen(opt));
|
||||
|
||||
uphp.ini_size += strlen(opt)+1;
|
||||
uwsgi_sapi_module.ini_entries[uphp.ini_size-1] = '\n';
|
||||
uwsgi_sapi_module.ini_entries[uphp.ini_size] = 0;
|
||||
}
|
||||
|
||||
// future implementation...
|
||||
|
||||
@@ -312,7 +312,9 @@ PyObject *py_uwsgi_call(PyObject * self, PyObject * args) {
|
||||
argvs[i] = PyString_Size(py_str);
|
||||
}
|
||||
|
||||
UWSGI_RELEASE_GIL;
|
||||
char *response = uwsgi_do_rpc(NULL, func, argc - 1, argv, argvs, &size);
|
||||
UWSGI_GET_GIL;
|
||||
|
||||
if (size > 0) {
|
||||
PyObject *ret = PyString_FromStringAndSize(response, size);
|
||||
@@ -381,7 +383,9 @@ PyObject *py_uwsgi_rpc(PyObject * self, PyObject * args) {
|
||||
argvs[i] = PyString_Size(py_str);
|
||||
}
|
||||
|
||||
UWSGI_RELEASE_GIL;
|
||||
char *response = uwsgi_do_rpc(node, func, argc - 2, argv, argvs, &size);
|
||||
UWSGI_GET_GIL;
|
||||
|
||||
if (size > 0) {
|
||||
PyObject *ret = PyString_FromStringAndSize(response, size);
|
||||
@@ -3272,16 +3276,20 @@ PyObject *py_uwsgi_queue_push(PyObject * self, PyObject * args) {
|
||||
}
|
||||
|
||||
if (uwsgi.queue_size) {
|
||||
UWSGI_RELEASE_GIL
|
||||
uwsgi_wlock(uwsgi.queue_lock);
|
||||
if (uwsgi_queue_push(message, msglen)) {
|
||||
uwsgi_rwunlock(uwsgi.queue_lock);
|
||||
UWSGI_GET_GIL
|
||||
Py_INCREF(Py_True);
|
||||
res = Py_True;
|
||||
}
|
||||
else {
|
||||
uwsgi_rwunlock(uwsgi.queue_lock);
|
||||
UWSGI_GET_GIL
|
||||
Py_INCREF(Py_None);
|
||||
res = Py_None;
|
||||
}
|
||||
uwsgi_rwunlock(uwsgi.queue_lock);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -3302,16 +3310,20 @@ PyObject *py_uwsgi_queue_set(PyObject * self, PyObject * args) {
|
||||
}
|
||||
|
||||
if (uwsgi.queue_size) {
|
||||
UWSGI_RELEASE_GIL
|
||||
uwsgi_wlock(uwsgi.queue_lock);
|
||||
if (uwsgi_queue_set(pos, message, msglen)) {
|
||||
uwsgi_rwunlock(uwsgi.queue_lock);
|
||||
UWSGI_GET_GIL
|
||||
Py_INCREF(Py_True);
|
||||
res = Py_True;
|
||||
}
|
||||
else {
|
||||
uwsgi_rwunlock(uwsgi.queue_lock);
|
||||
UWSGI_GET_GIL
|
||||
Py_INCREF(Py_None);
|
||||
res = Py_None;
|
||||
}
|
||||
uwsgi_rwunlock(uwsgi.queue_lock);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -3339,16 +3351,27 @@ PyObject *py_uwsgi_queue_pull(PyObject * self, PyObject * args) {
|
||||
PyObject *res;
|
||||
|
||||
if (uwsgi.queue_size) {
|
||||
UWSGI_RELEASE_GIL
|
||||
uwsgi_wlock(uwsgi.queue_lock);
|
||||
message = uwsgi_queue_pull(&size);
|
||||
UWSGI_GET_GIL
|
||||
if (message && size > 0) {
|
||||
res = PyString_FromStringAndSize(message, size);
|
||||
res = PyString_FromStringAndSize(NULL, size);
|
||||
#ifdef PYTHREE
|
||||
char *storage = PyBytes_AsString(res);
|
||||
#else
|
||||
char *storage = PyString_AS_STRING(res);
|
||||
#endif
|
||||
UWSGI_RELEASE_GIL
|
||||
memcpy(storage, message, size);
|
||||
}
|
||||
else {
|
||||
Py_INCREF(Py_None);
|
||||
res = Py_None;
|
||||
UWSGI_RELEASE_GIL
|
||||
}
|
||||
uwsgi_rwunlock(uwsgi.queue_lock);
|
||||
UWSGI_GET_GIL
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -3364,16 +3387,27 @@ PyObject *py_uwsgi_queue_pop(PyObject * self, PyObject * args) {
|
||||
PyObject *res;
|
||||
|
||||
if (uwsgi.queue_size) {
|
||||
UWSGI_RELEASE_GIL
|
||||
uwsgi_wlock(uwsgi.queue_lock);
|
||||
message = uwsgi_queue_pop(&size);
|
||||
if (message && size > 0) {
|
||||
res = PyString_FromStringAndSize(message, size);
|
||||
UWSGI_GET_GIL
|
||||
if (message && size > 0) {
|
||||
res = PyString_FromStringAndSize(NULL, size);
|
||||
#ifdef PYTHREE
|
||||
char *storage = PyBytes_AsString(res);
|
||||
#else
|
||||
char *storage = PyString_AS_STRING(res);
|
||||
#endif
|
||||
UWSGI_RELEASE_GIL
|
||||
memcpy(storage, message, size);
|
||||
}
|
||||
else {
|
||||
Py_INCREF(Py_None);
|
||||
res = Py_None;
|
||||
UWSGI_RELEASE_GIL
|
||||
}
|
||||
uwsgi_rwunlock(uwsgi.queue_lock);
|
||||
UWSGI_GET_GIL
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -3395,16 +3429,27 @@ PyObject *py_uwsgi_queue_get(PyObject * self, PyObject * args) {
|
||||
}
|
||||
|
||||
if (uwsgi.queue_size) {
|
||||
UWSGI_RELEASE_GIL
|
||||
uwsgi_rlock(uwsgi.queue_lock);
|
||||
message = uwsgi_queue_get(index, &size);
|
||||
if (message && size > 0) {
|
||||
res = PyString_FromStringAndSize(message, size);
|
||||
}
|
||||
else {
|
||||
Py_INCREF(Py_None);
|
||||
res = Py_None;
|
||||
}
|
||||
UWSGI_GET_GIL
|
||||
if (message && size > 0) {
|
||||
res = PyString_FromStringAndSize(NULL, size);
|
||||
#ifdef PYTHREE
|
||||
char *storage = PyBytes_AsString(res);
|
||||
#else
|
||||
char *storage = PyString_AS_STRING(res);
|
||||
#endif
|
||||
UWSGI_RELEASE_GIL
|
||||
memcpy(storage, message, size);
|
||||
}
|
||||
else {
|
||||
Py_INCREF(Py_None);
|
||||
res = Py_None;
|
||||
UWSGI_RELEASE_GIL
|
||||
}
|
||||
uwsgi_rwunlock(uwsgi.queue_lock);
|
||||
UWSGI_GET_GIL
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -3417,7 +3462,7 @@ PyObject *py_uwsgi_queue_last(PyObject * self, PyObject * args) {
|
||||
long num = 0;
|
||||
uint64_t size = 0;
|
||||
char *message;
|
||||
PyObject *res = NULL, *zero;
|
||||
PyObject *res = NULL;
|
||||
uint64_t base;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "|l:queue_last", &num)) {
|
||||
@@ -3430,6 +3475,7 @@ PyObject *py_uwsgi_queue_last(PyObject * self, PyObject * args) {
|
||||
res = PyList_New(0);
|
||||
}
|
||||
|
||||
UWSGI_RELEASE_GIL
|
||||
uwsgi_rlock(uwsgi.queue_lock);
|
||||
|
||||
if (uwsgi.queue_header->pos > 0) {
|
||||
@@ -3441,15 +3487,24 @@ PyObject *py_uwsgi_queue_last(PyObject * self, PyObject * args) {
|
||||
|
||||
if (num == 0) {
|
||||
message = uwsgi_queue_get(base, &size);
|
||||
if (message && size) {
|
||||
res = PyString_FromStringAndSize(message, size);
|
||||
UWSGI_GET_GIL
|
||||
if (message && size > 0) {
|
||||
res = PyString_FromStringAndSize(NULL, size);
|
||||
#ifdef PYTHREE
|
||||
char *storage = PyBytes_AsString(res);
|
||||
#else
|
||||
char *storage = PyString_AS_STRING(res);
|
||||
#endif
|
||||
UWSGI_RELEASE_GIL
|
||||
memcpy(storage, message, size);
|
||||
}
|
||||
else {
|
||||
Py_INCREF(Py_None);
|
||||
res = Py_None;
|
||||
Py_INCREF(Py_None);
|
||||
res = Py_None;
|
||||
UWSGI_RELEASE_GIL
|
||||
}
|
||||
|
||||
uwsgi_rwunlock(uwsgi.queue_lock);
|
||||
UWSGI_GET_GIL
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -3457,13 +3512,23 @@ PyObject *py_uwsgi_queue_last(PyObject * self, PyObject * args) {
|
||||
|
||||
while(num) {
|
||||
message = uwsgi_queue_get(base, &size);
|
||||
UWSGI_GET_GIL
|
||||
if (message && size) {
|
||||
zero = PyString_FromStringAndSize(message, size);
|
||||
PyObject *zero = PyString_FromStringAndSize(NULL, size);
|
||||
PyList_Append(res, zero);
|
||||
Py_DECREF(zero);
|
||||
#ifdef PYTHREE
|
||||
char *storage = PyBytes_AsString(res);
|
||||
#else
|
||||
char *storage = PyString_AS_STRING(res);
|
||||
#endif
|
||||
UWSGI_RELEASE_GIL
|
||||
memcpy(storage, message, size);
|
||||
}
|
||||
else {
|
||||
UWSGI_RELEASE_GIL
|
||||
uwsgi_rwunlock(uwsgi.queue_lock);
|
||||
UWSGI_GET_GIL
|
||||
return res;
|
||||
}
|
||||
if (base > 0) {
|
||||
@@ -3474,7 +3539,9 @@ PyObject *py_uwsgi_queue_last(PyObject * self, PyObject * args) {
|
||||
}
|
||||
num--;
|
||||
}
|
||||
UWSGI_RELEASE_GIL
|
||||
uwsgi_rwunlock(uwsgi.queue_lock);
|
||||
UWSGI_GET_GIL
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -3492,6 +3559,7 @@ PyObject *py_uwsgi_cache_get(PyObject * self, PyObject * args) {
|
||||
char *value = NULL;
|
||||
char *remote = NULL;
|
||||
char buffer[0xffff];
|
||||
PyObject *ret;
|
||||
|
||||
#ifdef UWSGI_DEBUG
|
||||
struct timeval tv, tv2;
|
||||
@@ -3524,7 +3592,7 @@ PyObject *py_uwsgi_cache_get(PyObject * self, PyObject * args) {
|
||||
return Py_None;
|
||||
}
|
||||
UWSGI_GET_GIL
|
||||
PyObject *ret = PyString_FromStringAndSize(NULL, valsize);
|
||||
ret = PyString_FromStringAndSize(NULL, valsize);
|
||||
#ifdef PYTHREE
|
||||
char *storage = PyBytes_AsString(ret);
|
||||
#else
|
||||
|
||||
@@ -233,6 +233,20 @@ int uwsgi_response_subhandler_wsgi(struct wsgi_request *wsgi_req) {
|
||||
uwsgi_apps[wsgi_req->app_id].exceptions++;
|
||||
PyErr_Print();
|
||||
}
|
||||
if (PyObject_HasAttrString((PyObject *)wsgi_req->async_result, "close")) {
|
||||
PyObject *close_method = PyObject_GetAttrString((PyObject *)wsgi_req->async_result, "close");
|
||||
PyObject *close_method_args = PyTuple_New(0);
|
||||
#ifdef UWSGI_DEBUG
|
||||
uwsgi_log("calling close() for %.*s %p %p\n", wsgi_req->uri_len, wsgi_req->uri, close_method, close_method_args);
|
||||
#endif
|
||||
PyObject *close_method_output = PyEval_CallObject(close_method, close_method_args);
|
||||
if (PyErr_Occurred()) {
|
||||
PyErr_Print();
|
||||
}
|
||||
Py_DECREF(close_method_args);
|
||||
Py_XDECREF(close_method_output);
|
||||
Py_DECREF(close_method);
|
||||
}
|
||||
goto clear;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,14 +7,15 @@ int uwsgi_request_signal(struct wsgi_request *wsgi_req) {
|
||||
|
||||
ssize_t len;
|
||||
uint8_t ret_status = 1;
|
||||
struct uwsgi_header uh;
|
||||
if (uwsgi_signal_send(uwsgi.signal_socket, wsgi_req->uh.modifier2) < 0) {
|
||||
ret_status = 0;
|
||||
}
|
||||
|
||||
wsgi_req->uh.modifier1 = 255;
|
||||
wsgi_req->uh.pktsize = 0;
|
||||
wsgi_req->uh.modifier2 = ret_status;
|
||||
len = write(wsgi_req->poll.fd, wsgi_req, 4);
|
||||
uh.modifier1 = 255;
|
||||
uh.pktsize = 0;
|
||||
uh.modifier2 = ret_status;
|
||||
len = write(wsgi_req->poll.fd, &uh, 4);
|
||||
if (len != 4) {
|
||||
uwsgi_error("write()");
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ int uwsgi_request_spooler(struct wsgi_request *wsgi_req) {
|
||||
|
||||
int i;
|
||||
char spool_filename[1024];
|
||||
struct uwsgi_header uh;
|
||||
|
||||
// get the spooler from the modifier2
|
||||
|
||||
@@ -24,11 +25,11 @@ int uwsgi_request_spooler(struct wsgi_request *wsgi_req) {
|
||||
}
|
||||
|
||||
i = spool_request(uspool, spool_filename, uwsgi.workers[0].requests + 1, wsgi_req->async_id, wsgi_req->buffer, wsgi_req->uh.pktsize, NULL, 0, NULL, 0);
|
||||
wsgi_req->uh.modifier1 = 255;
|
||||
wsgi_req->uh.pktsize = 0;
|
||||
uh.modifier1 = 255;
|
||||
uh.pktsize = 0;
|
||||
if (i > 0) {
|
||||
wsgi_req->uh.modifier2 = 1;
|
||||
if (write(wsgi_req->poll.fd, wsgi_req, 4) != 4) {
|
||||
uh.modifier2 = 1;
|
||||
if (write(wsgi_req->poll.fd, &uh, 4) != 4) {
|
||||
uwsgi_log("disconnected client, remove spool file.\n");
|
||||
/* client disconnect, remove spool file */
|
||||
if (unlink(spool_filename)) {
|
||||
@@ -41,8 +42,8 @@ int uwsgi_request_spooler(struct wsgi_request *wsgi_req) {
|
||||
}
|
||||
else {
|
||||
/* announce a failed spool request */
|
||||
wsgi_req->uh.modifier2 = 0;
|
||||
i = write(wsgi_req->poll.fd, wsgi_req, 4);
|
||||
uh.modifier2 = 0;
|
||||
i = write(wsgi_req->poll.fd, &uh, 4);
|
||||
if (i != 4) {
|
||||
uwsgi_error("write()");
|
||||
}
|
||||
|
||||
@@ -200,7 +200,6 @@ static int uwsgi_mongrel2_tnetstring_parse(struct wsgi_request *wsgi_req, char *
|
||||
wsgi_req->async_post = fopen(post_filename, "r");
|
||||
if (!wsgi_req->async_post) {
|
||||
uwsgi_error_open(post_filename);
|
||||
free(post_filename);
|
||||
wsgi_req->do_not_log = 1;
|
||||
}
|
||||
async_upload += 2;
|
||||
|
||||
@@ -26,7 +26,6 @@ int uwsgi_apply_routes(struct wsgi_request *wsgi_req) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
routes = routes->next;
|
||||
}
|
||||
|
||||
|
||||
@@ -777,7 +777,7 @@ void uwsgi_socket_nb(int fd) {
|
||||
int timed_connect(struct pollfd *fdpoll, const struct sockaddr *addr, int addr_size, int timeout, int async) {
|
||||
|
||||
int arg, ret;
|
||||
int soopt;
|
||||
int soopt = 0;
|
||||
socklen_t solen = sizeof(int);
|
||||
int cnt;
|
||||
/* set non-blocking socket */
|
||||
@@ -847,7 +847,6 @@ int timed_connect(struct pollfd *fdpoll, const struct sockaddr *addr, int addr_s
|
||||
}
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ pid_t spooler_start(struct uwsgi_spooler *uspool) {
|
||||
uwsgi_fixup_fds(0, 0, NULL);
|
||||
uwsgi_close_all_sockets();
|
||||
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->post_fork) {
|
||||
uwsgi.p[i]->post_fork();
|
||||
}
|
||||
@@ -109,7 +109,7 @@ pid_t spooler_start(struct uwsgi_spooler *uspool) {
|
||||
|
||||
uwsgi.signal_socket = uwsgi.shared->spooler_signal_pipe[1];
|
||||
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->spooler_init) {
|
||||
uwsgi.p[i]->spooler_init();
|
||||
}
|
||||
@@ -508,7 +508,7 @@ void spooler_manage_task(struct uwsgi_spooler *uspool, char *dir, char *task) {
|
||||
}
|
||||
|
||||
int callable_found = 0;
|
||||
for(i=0;i<0xff;i++) {
|
||||
for(i=0;i<256;i++) {
|
||||
if (uwsgi.p[i]->spooler) {
|
||||
time_t now = time(NULL);
|
||||
if(uwsgi.shared->options[UWSGI_OPTION_SPOOLER_HARAKIRI] > 0) {
|
||||
|
||||
@@ -567,6 +567,41 @@ void uwsgi_as_root() {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// fix ipcsem owner
|
||||
if (uwsgi.lock_ops.lock_init == uwsgi_lock_ipcsem_init) {
|
||||
struct uwsgi_lock_item *uli = uwsgi.registered_locks;
|
||||
|
||||
while(uli) {
|
||||
union semun {
|
||||
int val;
|
||||
struct semid_ds *buf;
|
||||
ushort *array;
|
||||
} semu ;
|
||||
|
||||
struct semid_ds sds;
|
||||
memset(&sds, 0, sizeof(sds));
|
||||
semu.buf = &sds;
|
||||
int semid = 0;
|
||||
memcpy(&semid, uli->lock_ptr, sizeof(int));
|
||||
|
||||
if (semctl(semid, 0, IPC_STAT, semu)) {
|
||||
uwsgi_error("semctl()");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
semu.buf->sem_perm.uid = uwsgi.uid;
|
||||
semu.buf->sem_perm.gid = uwsgi.gid;
|
||||
|
||||
if (semctl(semid, 0, IPC_SET, semu)) {
|
||||
uwsgi_error("semctl()");
|
||||
exit(1);
|
||||
}
|
||||
uli = uli->next;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (uwsgi.gid) {
|
||||
if (!uwsgi.master_as_root)
|
||||
uwsgi_log("setgid() to %d\n", uwsgi.gid);
|
||||
@@ -2067,6 +2102,10 @@ add:
|
||||
if (op->flags & UWSGI_OPT_POST_BUFFERING) {
|
||||
if (!uwsgi.post_buffering) uwsgi.post_buffering = 4096;
|
||||
}
|
||||
// requires building mime dict ?
|
||||
if (op->flags & UWSGI_OPT_MIME) {
|
||||
uwsgi.build_mime_dict = 1;
|
||||
}
|
||||
// immediate ?
|
||||
if (op->flags & UWSGI_OPT_IMMEDIATE) {
|
||||
op->func(key, value, op->data);
|
||||
@@ -4026,6 +4065,7 @@ char *uwsgi_check_touches(struct uwsgi_string_list *touch_list) {
|
||||
touch->custom = 0;
|
||||
}
|
||||
else {
|
||||
if (!touch->custom) touch->custom = (uint64_t) tr_st.st_mtime;
|
||||
if ((uint64_t) tr_st.st_mtime > touch->custom) {
|
||||
touch->custom = (uint64_t) tr_st.st_mtime;
|
||||
return touch->value;
|
||||
|
||||
@@ -149,6 +149,7 @@ static struct uwsgi_option uwsgi_base_options[] = {
|
||||
{"no-fd-passing", no_argument, 0, "disable file descriptor passing", uwsgi_opt_true, &uwsgi.no_fd_passing, 0},
|
||||
{"locks", required_argument, 0, "create the specified number of shared locks", uwsgi_opt_set_int, &uwsgi.locks, 0},
|
||||
{"lock-engine", required_argument, 0, "set the lock engine", uwsgi_opt_set_str, &uwsgi.lock_engine, 0},
|
||||
{"ftok", required_argument, 0, "set the ipcsem key via ftok() for avoiding duplicates", uwsgi_opt_set_str, &uwsgi.ftok, 0},
|
||||
{"sharedarea", required_argument, 'A', "create a raw shared memory area of specified pages", uwsgi_opt_set_int, &uwsgi.sharedareasize, 0},
|
||||
|
||||
{"cache", required_argument, 0, "create a shared cache containing given elements", uwsgi_opt_set_int, &uwsgi.cache_max_items, 0},
|
||||
@@ -321,7 +322,7 @@ static struct uwsgi_option uwsgi_base_options[] = {
|
||||
{"lazy", no_argument, 0, "set lazy mode (load apps in workers instead of master)", uwsgi_opt_true, &uwsgi.lazy, 0},
|
||||
{"cheap", no_argument, 0, "set cheap mode (spawn workers only after the first request)", uwsgi_opt_true, &uwsgi.cheap, 0},
|
||||
{"cheaper", required_argument, 0, "set cheaper mode (adaptive process spawning)", uwsgi_opt_set_int, &uwsgi.cheaper_count, UWSGI_OPT_MASTER|UWSGI_OPT_CHEAPER},
|
||||
{"cheaper-algo", required_argument, 0, "choose to algorithm used for adaptive process spawning)", uwsgi_opt_set_str, &uwsgi.requested_cheaper_algo, UWSGI_OPT_MASTER|UWSGI_OPT_CHEAPER},
|
||||
{"cheaper-algo", required_argument, 0, "choose to algorithm used for adaptive process spawning)", uwsgi_opt_set_str, &uwsgi.requested_cheaper_algo, UWSGI_OPT_MASTER},
|
||||
{"cheaper-step", required_argument, 0, "number of additional processes to spawn at each overload", uwsgi_opt_set_int, &uwsgi.cheaper_step, UWSGI_OPT_MASTER|UWSGI_OPT_CHEAPER},
|
||||
{"cheaper-overload", required_argument, 0, "increase workers after specified overload", uwsgi_opt_set_64bit, &uwsgi.cheaper_overload, UWSGI_OPT_MASTER|UWSGI_OPT_CHEAPER},
|
||||
{"idle", required_argument, 0, "set idle mode (put uWSGI in cheap mode after inactivity)", uwsgi_opt_set_int, &uwsgi.idle, 0},
|
||||
@@ -348,7 +349,7 @@ static struct uwsgi_option uwsgi_base_options[] = {
|
||||
#endif
|
||||
{"add-header", required_argument, 0, "automatically add HTTP headers to response", uwsgi_opt_add_string_list, &uwsgi.additional_headers, 0},
|
||||
{"check-static", required_argument, 0, "check for static files in the specified directory", uwsgi_opt_check_static, NULL, 0},
|
||||
{"check-static-docroot", no_argument, 0, "check for static files in the requested DOCUMENT_ROOT", uwsgi_opt_true, &uwsgi.check_static_docroot, 0},
|
||||
{"check-static-docroot", no_argument, 0, "check for static files in the requested DOCUMENT_ROOT", uwsgi_opt_true, &uwsgi.check_static_docroot, UWSGI_OPT_MIME},
|
||||
{"static-check", required_argument, 0, "check for static files in the specified directory", uwsgi_opt_check_static, NULL, 0},
|
||||
{"static-map", required_argument, 0, "map mountpoint to static directory", uwsgi_opt_static_map, NULL, 0},
|
||||
{"static-skip-ext", required_argument, 0, "skip specified extension from staticfile checks", uwsgi_opt_add_string_list, &uwsgi.static_skip_ext, 0},
|
||||
@@ -1082,7 +1083,7 @@ void uwsgi_plugins_atexit(void) {
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j<0xFF; j++) {
|
||||
for (j = 0; j<256; j++) {
|
||||
if (uwsgi.p[j]->atexit) {
|
||||
uwsgi.p[j]->atexit();
|
||||
}
|
||||
@@ -1256,7 +1257,7 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||
uwsgi.shared->spooler_frequency = 30;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
uwsgi.p[i] = &unconfigured_plugin;
|
||||
}
|
||||
|
||||
@@ -1493,7 +1494,7 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||
}
|
||||
}
|
||||
if (!magic) {
|
||||
for (j = 0; j < 0xFF; j++) {
|
||||
for (j = 0; j < 256; j++) {
|
||||
if (uwsgi.p[j]->magic) {
|
||||
if (uwsgi.p[j]->magic(NULL, lazy)) {
|
||||
magic = 1;
|
||||
@@ -1669,7 +1670,7 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||
uwsgi_sock->fd = shared_sock->fd;
|
||||
uwsgi_sock->family = shared_sock->family;
|
||||
uwsgi_sock->name = shared_sock->name;
|
||||
uwsgi_log("uwsgi socket %d mapped to shared socket %d (%s)\n", uwsgi_get_socket_num(uwsgi_sock), uwsgi_get_shared_socket_num(shared_sock), shared_sock->name);
|
||||
uwsgi_log("uwsgi socket %d mapped to shared socket %d (%s) fd %d\n", uwsgi_get_socket_num(uwsgi_sock), uwsgi_get_shared_socket_num(shared_sock), shared_sock->name, uwsgi_sock->fd);
|
||||
}
|
||||
|
||||
uwsgi_sock = uwsgi_sock->next;
|
||||
@@ -2356,7 +2357,7 @@ skipzero:
|
||||
|
||||
// initialize request plugin only if workers or master are available
|
||||
if (uwsgi.sockets || uwsgi.master_process || uwsgi.no_server || uwsgi.command_mode) {
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->init) {
|
||||
uwsgi.p[i]->init();
|
||||
}
|
||||
@@ -2372,7 +2373,7 @@ skipzero:
|
||||
|
||||
// again check for workers/sockets...
|
||||
if (uwsgi.sockets || uwsgi.master_process || uwsgi.no_server || uwsgi.command_mode) {
|
||||
for (i = 0; i < 0xff; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->post_init) {
|
||||
uwsgi.p[i]->post_init();
|
||||
}
|
||||
@@ -2400,7 +2401,7 @@ skipzero:
|
||||
|
||||
// again check for workers/sockets...
|
||||
if (uwsgi.sockets || uwsgi.master_process || uwsgi.no_server || uwsgi.command_mode) {
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->enable_threads)
|
||||
uwsgi.p[i]->enable_threads();
|
||||
}
|
||||
@@ -2605,7 +2606,7 @@ skipzero:
|
||||
}
|
||||
|
||||
// preinit apps (create the language environment)
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->preinit_apps) {
|
||||
uwsgi.p[i]->preinit_apps();
|
||||
}
|
||||
@@ -2680,7 +2681,7 @@ skipzero:
|
||||
|
||||
// security in multiuser environment: allow only a subset of modifiers
|
||||
if (uwsgi.allowed_modifiers) {
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (!uwsgi_list_has_num(uwsgi.allowed_modifiers, i)) {
|
||||
uwsgi.p[i]->request = unconfigured_hook;
|
||||
uwsgi.p[i]->after_request = unconfigured_after_hook;
|
||||
@@ -2689,7 +2690,7 @@ skipzero:
|
||||
}
|
||||
|
||||
// master fixup
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->master_fixup) {
|
||||
uwsgi.p[i]->master_fixup(0);
|
||||
}
|
||||
@@ -2890,7 +2891,7 @@ skipzero:
|
||||
uwsgi_init_all_apps();
|
||||
}
|
||||
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->post_fork) {
|
||||
uwsgi.p[i]->post_fork();
|
||||
}
|
||||
@@ -3024,7 +3025,7 @@ skipzero:
|
||||
//initialization done
|
||||
|
||||
// run fixup handler
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->fixup) {
|
||||
uwsgi.p[i]->fixup();
|
||||
}
|
||||
@@ -3090,7 +3091,7 @@ void uwsgi_ignition() {
|
||||
uwsgi_log("[snapshot] process %d is the new worker %d\n", (int) getpid(), uwsgi.mywid);
|
||||
}
|
||||
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->hijack_worker) {
|
||||
uwsgi.p[i]->hijack_worker();
|
||||
}
|
||||
@@ -3196,7 +3197,7 @@ void build_options() {
|
||||
op++;
|
||||
}
|
||||
|
||||
for(i=0;i<0xFF;i++) {
|
||||
for(i=0;i<256;i++) {
|
||||
if (uwsgi.p[i]->options) {
|
||||
options_count += uwsgi_count_options(uwsgi.p[i]->options);
|
||||
}
|
||||
@@ -3219,7 +3220,7 @@ void build_options() {
|
||||
op++;
|
||||
}
|
||||
|
||||
for(i=0;i<0xFF;i++) {
|
||||
for(i=0;i<256;i++) {
|
||||
if (uwsgi.p[i]->options) {
|
||||
int c = uwsgi_count_options(uwsgi.p[i]->options);
|
||||
memcpy(&uwsgi.options[pos], uwsgi.p[i]->options, sizeof(struct uwsgi_option) * c);
|
||||
@@ -3352,7 +3353,7 @@ void uwsgi_init_all_apps() {
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < 0xFF; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (uwsgi.p[i]->init_apps) {
|
||||
uwsgi.p[i]->init_apps();
|
||||
}
|
||||
@@ -3370,7 +3371,7 @@ void uwsgi_init_all_apps() {
|
||||
what[0] = 0;
|
||||
what++;
|
||||
uwsgi_log("mounting %s on %s\n", what, uwsgi.mounts[i]);
|
||||
for (j = 0; j < 0xFF; j++) {
|
||||
for (j = 0; j < 256; j++) {
|
||||
if (uwsgi.p[j]->mount_app) {
|
||||
if (!uwsgi_startswith(uwsgi.mounts[i], "regexp://", 9)) {
|
||||
if (uwsgi.p[j]->mount_app(uwsgi.mounts[i]+9, what, 1) != -1)
|
||||
|
||||
@@ -50,6 +50,7 @@ extern "C" {
|
||||
#define UWSGI_OPT_NO_SERVER (1 << 10)
|
||||
#define UWSGI_OPT_POST_BUFFERING (1 << 11)
|
||||
#define UWSGI_OPT_CLUSTER (1 << 12)
|
||||
#define UWSGI_OPT_MIME (1 << 13)
|
||||
|
||||
#define MAX_APPS 64
|
||||
#define MAX_GENERIC_PLUGINS 64
|
||||
@@ -140,6 +141,9 @@ extern char UWSGI_EMBED_CONFIG_END;
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/sem.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
#ifndef __USE_ISOC99
|
||||
@@ -390,6 +394,7 @@ struct uwsgi_gateway_socket {
|
||||
// this requires SCTP
|
||||
int sctp;
|
||||
#endif
|
||||
int shared;
|
||||
|
||||
char *owner;
|
||||
struct uwsgi_gateway *gateway;
|
||||
@@ -1524,7 +1529,7 @@ struct uwsgi_server {
|
||||
struct uwsgi_loop loops[MAX_LOOPS];
|
||||
int loops_cnt;
|
||||
|
||||
struct uwsgi_plugin *p[0xFF];
|
||||
struct uwsgi_plugin *p[256];
|
||||
struct uwsgi_plugin *gp[MAX_GENERIC_PLUGINS];
|
||||
int gp_cnt;
|
||||
|
||||
@@ -1540,6 +1545,7 @@ struct uwsgi_server {
|
||||
struct uwsgi_lock_item *registered_locks;
|
||||
struct uwsgi_lock_ops lock_ops;
|
||||
char *lock_engine;
|
||||
char *ftok;
|
||||
char *lock_id;
|
||||
size_t lock_size;
|
||||
size_t rwlock_size;
|
||||
@@ -2745,6 +2751,8 @@ char *uwsgi_read_fd(int, int *, int);
|
||||
|
||||
void uwsgi_setup_post_buffering(void);
|
||||
|
||||
struct uwsgi_lock_item *uwsgi_lock_ipcsem_init(char *);
|
||||
|
||||
#ifdef UWSGI_AS_SHARED_LIBRARY
|
||||
int uwsgi_init(int, char **, char **);
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# uWSGI build system
|
||||
|
||||
uwsgi_version = '1.1'
|
||||
uwsgi_version = '1.1-rc3'
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
Reference in New Issue
Block a user