allows mixing shared RPC with unshared

This commit is contained in:
Unbit
2013-03-03 13:56:38 +01:00
parent 773d853bb4
commit 2e4bc3dc6b
4 changed files with 20 additions and 2 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ void uwsgi_master_cleanup_hooks(void) {
int j;
// could be an inherited atexit hook
if (uwsgi.mywid > 0)
if (uwsgi.mypid != uwsgi.workers[0].pid)
return;
uwsgi.status.is_cleaning = 1;
+17 -1
View File
@@ -22,11 +22,27 @@ int uwsgi_register_rpc(char *name, uint8_t modifier1, uint8_t args, void *func)
urpc->modifier1 = modifier1;
urpc->args = args;
urpc->func = func;
urpc->shared = uwsgi.mywid == 0 ? 1 : 0;
uwsgi.shared->rpc_count[uwsgi.mywid]++;
ret = 0;
uwsgi_log("registered RPC function %s\n", name);
if (uwsgi.mywid == 0) {
uwsgi_log("registered shared/inherited RPC function \"%s\"\n", name);
}
else {
uwsgi_log("registered RPC function \"%s\" on worker %d\n", name, uwsgi.mywid);
}
}
// implement cow
if (uwsgi.mywid == 0) {
int i;
for(i=1;i<=uwsgi.numproc;i++) {
uwsgi.shared->rpc_count[i] = uwsgi.shared->rpc_count[0];
int pos = (i * uwsgi.rpc_max);
memcpy(&uwsgi.rpc_table[pos], uwsgi.rpc_table, sizeof(struct uwsgi_rpc) * uwsgi.rpc_max);
}
}
uwsgi_unlock(uwsgi.rpc_table_lock);
+1
View File
@@ -141,6 +141,7 @@ static int carbon_write(int fd, char *fmt,...) {
static void carbon_push_stats(int retry_cycle, time_t now) {
struct carbon_server_list *usl = u_carbon.servers_data;
if (!u_carbon.servers_data) return;
int i;
int fd;
int wok;
+1
View File
@@ -2244,6 +2244,7 @@ struct uwsgi_rpc {
void *func;
uint8_t args;
uint8_t modifier1;
uint8_t shared;
};
struct uwsgi_signal_entry {