aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2018-06-11 11:36:19 -0700
committerGravatar ncteisen <ncteisen@gmail.com>2018-06-13 10:36:32 -0700
commitf82e28fb6f6d94f37bc646c1899f2e412e4b949e (patch)
tree73eb167b910479177c2c976616a726fe7d7290b0 /src/core/lib/iomgr
parentfeead68be9b85a731088e73abaf756d80da71b93 (diff)
Clean up use of GRPC_ARG_INTEGER
Diffstat (limited to 'src/core/lib/iomgr')
-rw-r--r--src/core/lib/iomgr/tcp_server_posix.cc21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/core/lib/iomgr/tcp_server_posix.cc b/src/core/lib/iomgr/tcp_server_posix.cc
index 8ddf684fea..0efdeab80e 100644
--- a/src/core/lib/iomgr/tcp_server_posix.cc
+++ b/src/core/lib/iomgr/tcp_server_posix.cc
@@ -63,23 +63,14 @@ static grpc_error* tcp_server_create(grpc_closure* shutdown_complete,
s->so_reuseport = grpc_is_socket_reuse_port_supported();
s->expand_wildcard_addrs = false;
for (size_t i = 0; i < (args == nullptr ? 0 : args->num_args); i++) {
+ // TODO(roth): I chose that these both default to true. Is this reasonable?
+ // Before they would create errors, so this is actually making the
+ // restrictions more lenient.
if (0 == strcmp(GRPC_ARG_ALLOW_REUSEPORT, args->args[i].key)) {
- if (args->args[i].type == GRPC_ARG_INTEGER) {
- s->so_reuseport = grpc_is_socket_reuse_port_supported() &&
- (args->args[i].value.integer != 0);
- } else {
- gpr_free(s);
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(GRPC_ARG_ALLOW_REUSEPORT
- " must be an integer");
- }
+ s->so_reuseport = grpc_channel_arg_get_bool(&args->args[i], true);
} else if (0 == strcmp(GRPC_ARG_EXPAND_WILDCARD_ADDRS, args->args[i].key)) {
- if (args->args[i].type == GRPC_ARG_INTEGER) {
- s->expand_wildcard_addrs = (args->args[i].value.integer != 0);
- } else {
- gpr_free(s);
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
- GRPC_ARG_EXPAND_WILDCARD_ADDRS " must be an integer");
- }
+ s->expand_wildcard_addrs =
+ grpc_channel_arg_get_bool(&args->args[i], true);
}
}
gpr_ref_init(&s->refs, 1);