mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-10-03 15:38:36 +00:00
allows mixing shared RPC with unshared
This commit is contained in:
+1
-1
@@ -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
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user