Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into plugin_credential…
Browse files Browse the repository at this point in the history
…s_api_fix
  • Loading branch information
markdroth committed Sep 28, 2017
2 parents 61b26f9 + fde890e commit 6456e49
Show file tree
Hide file tree
Showing 45 changed files with 1,744 additions and 439 deletions.
6 changes: 6 additions & 0 deletions include/grpc++/support/channel_arguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ class ChannelArguments {
/// Set the compression algorithm for the channel.
void SetCompressionAlgorithm(grpc_compression_algorithm algorithm);

/// Set the grpclb fallback timeout (in ms) for the channel. If this amount
/// of time has passed but we have not gotten any non-empty \a serverlist from
/// the balancer, we will fall back to use the backend address(es) returned by
/// the resolver.
void SetGrpclbFallbackTimeout(int fallback_timeout);

/// Set the socket mutator for the channel.
void SetSocketMutator(grpc_socket_mutator* mutator);

Expand Down
6 changes: 5 additions & 1 deletion include/grpc/impl/codegen/grpc_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,11 @@ typedef struct {
"grpc.experimental.tcp_max_read_chunk_size"
/* Timeout in milliseconds to use for calls to the grpclb load balancer.
If 0 or unset, the balancer calls will have no deadline. */
#define GRPC_ARG_GRPCLB_CALL_TIMEOUT_MS "grpc.grpclb_timeout_ms"
#define GRPC_ARG_GRPCLB_CALL_TIMEOUT_MS "grpc.grpclb_call_timeout_ms"
/* Timeout in milliseconds to wait for the serverlist from the grpclb load
balancer before using fallback backend addresses from the resolver.
If 0, fallback will never be used. */
#define GRPC_ARG_GRPCLB_FALLBACK_TIMEOUT_MS "grpc.grpclb_fallback_timeout_ms"
/** If non-zero, grpc server's cronet compression workaround will be enabled */
#define GRPC_ARG_WORKAROUND_CRONET_COMPRESSION \
"grpc.workaround.cronet_compression"
Expand Down
1 change: 0 additions & 1 deletion include/grpc/impl/codegen/port_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@
#define _BSD_SOURCE
#endif
#if TARGET_OS_IPHONE
#define GPR_FORBID_UNREACHABLE_CODE 1
#define GPR_PLATFORM_STRING "ios"
#define GPR_CPU_IPHONE 1
#define GPR_PTHREAD_TLS 1
Expand Down
28 changes: 12 additions & 16 deletions src/core/ext/filters/client_channel/http_proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,27 +91,22 @@ static bool proxy_mapper_map_name(grpc_exec_ctx* exec_ctx,
char* user_cred = NULL;
*name_to_resolve = get_http_proxy_server(exec_ctx, &user_cred);
if (*name_to_resolve == NULL) return false;
char* no_proxy_str = NULL;
grpc_uri* uri =
grpc_uri_parse(exec_ctx, server_uri, false /* suppress_errors */);
if (uri == NULL || uri->path[0] == '\0') {
gpr_log(GPR_ERROR,
"'http_proxy' environment variable set, but cannot "
"parse server URI '%s' -- not using proxy",
server_uri);
if (uri != NULL) {
gpr_free(user_cred);
grpc_uri_destroy(uri);
}
return false;
goto no_use_proxy;
}
if (strcmp(uri->scheme, "unix") == 0) {
gpr_log(GPR_INFO, "not using proxy for Unix domain socket '%s'",
server_uri);
gpr_free(user_cred);
grpc_uri_destroy(uri);
return false;
goto no_use_proxy;
}
char* no_proxy_str = gpr_getenv("no_proxy");
no_proxy_str = gpr_getenv("no_proxy");
if (no_proxy_str != NULL) {
static const char* NO_PROXY_SEPARATOR = ",";
bool use_proxy = true;
Expand Down Expand Up @@ -147,12 +142,7 @@ static bool proxy_mapper_map_name(grpc_exec_ctx* exec_ctx,
gpr_free(no_proxy_hosts);
gpr_free(server_host);
gpr_free(server_port);
if (!use_proxy) {
grpc_uri_destroy(uri);
gpr_free(*name_to_resolve);
*name_to_resolve = NULL;
return false;
}
if (!use_proxy) goto no_use_proxy;
}
}
grpc_arg args_to_add[2];
Expand All @@ -173,9 +163,15 @@ static bool proxy_mapper_map_name(grpc_exec_ctx* exec_ctx,
} else {
*new_args = grpc_channel_args_copy_and_add(args, args_to_add, 1);
}
gpr_free(user_cred);
grpc_uri_destroy(uri);
gpr_free(user_cred);
return true;
no_use_proxy:
if (uri != NULL) grpc_uri_destroy(uri);
gpr_free(*name_to_resolve);
*name_to_resolve = NULL;
gpr_free(user_cred);
return false;
}

static bool proxy_mapper_map_address(grpc_exec_ctx* exec_ctx,
Expand Down
Loading

0 comments on commit 6456e49

Please sign in to comment.