diff --git a/core/legion.c b/core/legion.c index cc5facb2..c09516b1 100644 --- a/core/legion.c +++ b/core/legion.c @@ -775,6 +775,21 @@ err: return -1; } +void uwsgi_opt_legion_mcast(char *opt, char *value, void *foobar) { + uwsgi_opt_legion(opt, value, foobar); + char *legion = uwsgi_str(value); + char *space = strchr(legion, ' '); + // over engineering + if (!space) exit(1); + *space = 0; + struct uwsgi_legion *ul = uwsgi_legion_get_by_name(legion); + if (!ul) { + uwsgi_log("unknown legion: %s\n", legion); + exit(1); + } + uwsgi_legion_register_node(ul, uwsgi_str(ul->addr)); +} + void uwsgi_opt_legion_node(char *opt, char *value, void *foobar) { char *legion = uwsgi_str(value); diff --git a/core/uwsgi.c b/core/uwsgi.c index db360e93..50045a5f 100644 --- a/core/uwsgi.c +++ b/core/uwsgi.c @@ -371,6 +371,7 @@ static struct uwsgi_option uwsgi_base_options[] = { #ifdef UWSGI_SSL {"legion", required_argument, 0, "became a member of a legion", uwsgi_opt_legion, NULL, UWSGI_OPT_MASTER}, + {"legion-mcast", required_argument, 0, "became a member of a legion (shortcut for multicast)", uwsgi_opt_legion_mcast, NULL, UWSGI_OPT_MASTER}, {"legion-node", required_argument, 0, "add a node to a legion", uwsgi_opt_legion_node, NULL, UWSGI_OPT_MASTER}, {"legion-freq", required_argument, 0, "set the frequency of legion packets", uwsgi_opt_set_int, &uwsgi.legion_freq, UWSGI_OPT_MASTER}, {"legion-tolerance", required_argument, 0, "set the tolerance of legion subsystem", uwsgi_opt_set_int, &uwsgi.legion_tolerance, UWSGI_OPT_MASTER}, diff --git a/uwsgi.h b/uwsgi.h index c866eb29..8e09727d 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -3714,6 +3714,7 @@ char *uwsgi_strip(char *); #ifdef UWSGI_SSL void uwsgi_opt_legion(char *, char *, void *); +void uwsgi_opt_legion_mcast(char *, char *, void *); struct uwsgi_legion *uwsgi_legion_register(char *, char *, char *, char *, char *); void uwsgi_opt_legion_node(char *, char *, void *); void uwsgi_legion_register_node(struct uwsgi_legion *, char *);