diff --git a/include/haproxy/receiver-t.h b/include/haproxy/receiver-t.h index b83fe1ac0..4372d4697 100644 --- a/include/haproxy/receiver-t.h +++ b/include/haproxy/receiver-t.h @@ -50,7 +50,7 @@ struct rx_settings { char *interface; /* interface name or NULL */ const struct netns_entry *netns; /* network namespace of the listener*/ unsigned int options; /* receiver options (RX_O_*) */ - uint shards; /* number of shards */ + int shards; /* number of shards, 0=not set yet, -1="by-thread" */ }; /* This describes a receiver with all its characteristics (address, options, etc) */ diff --git a/src/cfgparse.c b/src/cfgparse.c index 4272c3df1..aba342d6d 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -2972,6 +2972,10 @@ init_proxies_list_stage1: shards = bind_conf->settings.shards; todo = thread_set_count(&bind_conf->thread_set); + /* special values: -1 = "by-thread" */ + if (shards == -1) + shards = todo; + /* no more shards than total threads */ if (shards > todo) shards = todo; diff --git a/src/listener.c b/src/listener.c index 2e373a361..ce7f56993 100644 --- a/src/listener.c +++ b/src/listener.c @@ -1865,7 +1865,7 @@ static int bind_parse_shards(char **args, int cur_arg, struct proxy *px, struct } if (strcmp(args[cur_arg + 1], "by-thread") == 0) { - val = MAX_THREADS; /* will be trimmed later anyway */ + val = -1; /* -1 = "by-thread", will be fixed in check_config_validity() */ } else { val = atol(args[cur_arg + 1]); if (val < 1 || val > MAX_THREADS) {