diff options
author | Igor Sysoev <igor@sysoev.ru> | 2020-03-30 19:47:01 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2020-03-30 19:47:01 +0300 |
commit | 01e957ef64b63403ac2e9107e2a84578d68a09b3 (patch) | |
tree | 7f7f1063c44e6903f88b5f3861f171b0d065ad8a /src/nxt_conf_validation.c | |
parent | 68c6b67ffc840c78eddd27a65e9bf1370aaf5631 (diff) | |
download | unit-01e957ef64b63403ac2e9107e2a84578d68a09b3.tar.gz unit-01e957ef64b63403ac2e9107e2a84578d68a09b3.tar.bz2 |
Rational number support in upstream server weight.
Diffstat (limited to 'src/nxt_conf_validation.c')
-rw-r--r-- | src/nxt_conf_validation.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nxt_conf_validation.c b/src/nxt_conf_validation.c index aa48845a..bc03bdfb 100644 --- a/src/nxt_conf_validation.c +++ b/src/nxt_conf_validation.c @@ -732,7 +732,7 @@ static nxt_conf_vldt_object_t nxt_conf_vldt_upstream_members[] = { static nxt_conf_vldt_object_t nxt_conf_vldt_upstream_server_members[] = { { nxt_string("weight"), - NXT_CONF_VLDT_INTEGER, + NXT_CONF_VLDT_NUMBER, &nxt_conf_vldt_server_weight, NULL }, @@ -2060,18 +2060,18 @@ static nxt_int_t nxt_conf_vldt_server_weight(nxt_conf_validation_t *vldt, nxt_conf_value_t *value, void *data) { - int64_t int_value; + double num_value; - int_value = nxt_conf_get_number(value); + num_value = nxt_conf_get_number(value); - if (int_value <= 0) { + if (num_value < 0) { return nxt_conf_vldt_error(vldt, "The \"weight\" number must be " - "greater than 0."); + "positive."); } - if (int_value > NXT_INT32_T_MAX) { + if (num_value > 1000000) { return nxt_conf_vldt_error(vldt, "The \"weight\" number must " - "not exceed %d.", NXT_INT32_T_MAX); + "not exceed 1,000,000"); } return NXT_OK; |