Skip to content

Commit

Permalink
allows plugin 255 to be used
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto@precise64 committed Mar 15, 2012
1 parent fe28e90 commit 319ad13
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions master.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion master_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,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);
}
Expand Down
8 changes: 4 additions & 4 deletions mule.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@ 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();
}
}


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
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion plugins.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions spooler.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ 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();
}
}

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();
}
Expand Down Expand Up @@ -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) {
Expand Down
32 changes: 16 additions & 16 deletions uwsgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1083,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();
}
Expand Down Expand Up @@ -1257,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;
}

Expand Down Expand Up @@ -1494,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;
Expand Down Expand Up @@ -2357,7 +2357,7 @@ int uwsgi_start(void *v_argv) {

// 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();
}
Expand All @@ -2373,7 +2373,7 @@ int uwsgi_start(void *v_argv) {

// 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();
}
Expand Down Expand Up @@ -2401,7 +2401,7 @@ int uwsgi_start(void *v_argv) {

// 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();
}
Expand Down Expand Up @@ -2606,7 +2606,7 @@ int uwsgi_start(void *v_argv) {
}

// 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();
}
Expand Down Expand Up @@ -2681,7 +2681,7 @@ int uwsgi_start(void *v_argv) {

// 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;
Expand All @@ -2690,7 +2690,7 @@ int uwsgi_start(void *v_argv) {
}

// 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);
}
Expand Down Expand Up @@ -2891,7 +2891,7 @@ int uwsgi_start(void *v_argv) {
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();
}
Expand Down Expand Up @@ -3025,7 +3025,7 @@ int uwsgi_start(void *v_argv) {
//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();
}
Expand Down Expand Up @@ -3091,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();
}
Expand Down Expand Up @@ -3197,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);
}
Expand All @@ -3220,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);
Expand Down Expand Up @@ -3353,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();
}
Expand All @@ -3371,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)
Expand Down
2 changes: 1 addition & 1 deletion uwsgi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1529,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;

Expand Down

0 comments on commit 319ad13

Please sign in to comment.