completed clustering porting

This commit is contained in:
roberto@precise64
2012-02-26 12:30:35 +01:00
parent b4f8a3b179
commit 4da4fb4cbd
3 changed files with 18 additions and 3 deletions
+4
View File
@@ -2016,6 +2016,10 @@ add:
if (op->flags & UWSGI_OPT_NO_SERVER) {
uwsgi.no_server = 1;
}
// requires cluster ?
if (op->flags & UWSGI_OPT_CLUSTER) {
uwsgi.cluster = value;
}
// requires post_buffering ?
if (op->flags & UWSGI_OPT_POST_BUFFERING) {
if (!uwsgi.post_buffering) uwsgi.post_buffering = 4096;
+11 -3
View File
@@ -248,9 +248,9 @@ static struct uwsgi_option uwsgi_base_options[] = {
#ifdef UWSGI_MULTICAST
{"multicast", required_argument, 0, "subscribe to specified multicast group", uwsgi_opt_set_str, &uwsgi.multicast_group, UWSGI_OPT_MASTER},
{"cluster", required_argument, 0, "join specified uWSGI cluster", uwsgi_opt_set_str, &uwsgi.cluster, UWSGI_OPT_MASTER},
//{"cluster-nodes", required_argument, 0, LONG_ARGS_CLUSTER_NODES,0},
//{"cluster-reload", required_argument, 0, LONG_ARGS_CLUSTER_RELOAD,0},
//{"cluster-log", required_argument, 0, LONG_ARGS_CLUSTER_LOG,0},
{"cluster-nodes", required_argument, 0, "get nodes list from the specified cluster", uwsgi_opt_true, &uwsgi.cluster_nodes, UWSGI_OPT_MASTER|UWSGI_OPT_CLUSTER},
{"cluster-reload", required_argument, 0, "send a reload message to the cluster", uwsgi_opt_cluster_reload, NULL, 0},
{"cluster-log", required_argument, 0, "send a log line to the cluster", uwsgi_opt_cluster_log, NULL, 0},
#endif
{"subscribe-to", required_argument, 0, "subscribe to the specified subscription server", uwsgi_opt_add_string_list, &uwsgi.subscriptions, UWSGI_OPT_MASTER},
{"st", required_argument, 0, "subscribe to the specified subscription server", uwsgi_opt_add_string_list, &uwsgi.subscriptions, UWSGI_OPT_MASTER},
@@ -3311,6 +3311,14 @@ void uwsgi_opt_true(char *opt, char *value, void *key) {
}
}
void uwsgi_opt_cluster_reload(char *opt, char *value, void *foobar) {
send_udp_message(98, 0, value, NULL, 0);
}
void uwsgi_opt_cluster_log(char *opt, char *value, void *foobar) {
uwsgi_stdin_sendto(value, 96, 0);
}
void uwsgi_opt_set_int(char *opt, char *value, void *key) {
int *ptr = (int *) key;
if (value) {
+3
View File
@@ -49,6 +49,7 @@ extern "C" {
#define UWSGI_OPT_NO_INITIAL (1 << 9)
#define UWSGI_OPT_NO_SERVER (1 << 10)
#define UWSGI_OPT_POST_BUFFERING (1 << 11)
#define UWSGI_OPT_CLUSTER (1 << 12)
#define MAX_APPS 64
#define MAX_GENERIC_PLUGINS 64
@@ -2568,6 +2569,8 @@ void uwsgi_opt_add_socket(char *, char *, void *);
void uwsgi_opt_add_cron(char *, char *, void *);
void uwsgi_opt_load_plugin(char *, char *, void *);
void uwsgi_opt_load(char *, char *, void *);
void uwsgi_opt_cluster_log(char *, char *, void *);
void uwsgi_opt_cluster_reload(char *, char *, void *);
#ifdef UWSGI_INI
void uwsgi_opt_load_ini(char *, char *, void *);
#endif