aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/lb_policy
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2016-10-26 09:12:25 -0700
committerGravatar Mark D. Roth <roth@google.com>2016-10-26 09:12:25 -0700
commitfb809b78508b8ab0cca85fab63e8fbcde2540d32 (patch)
treebdb1e9c208d72e8d627a348de32388f5eea1d816 /src/core/ext/lb_policy
parentb477cebbe77fca069fb2a4bb1e9806e0891ead83 (diff)
parent4c2e3e7bb9f32d252a664bb83c5dea3ecda65a9b (diff)
Merge remote-tracking branch 'upstream/master' into resolver_channel_args
Diffstat (limited to 'src/core/ext/lb_policy')
-rw-r--r--src/core/ext/lb_policy/grpclb/grpclb.c21
-rw-r--r--src/core/ext/lb_policy/pick_first/pick_first.c3
-rw-r--r--src/core/ext/lb_policy/round_robin/round_robin.c3
3 files changed, 14 insertions, 13 deletions
diff --git a/src/core/ext/lb_policy/grpclb/grpclb.c b/src/core/ext/lb_policy/grpclb/grpclb.c
index b0ec5633a7..6d73c48cc3 100644
--- a/src/core/ext/lb_policy/grpclb/grpclb.c
+++ b/src/core/ext/lb_policy/grpclb/grpclb.c
@@ -96,6 +96,12 @@
* - Implement LB service forwarding (point 2c. in the doc's diagram).
*/
+/* With the addition of a libuv endpoint, sockaddr.h now includes uv.h when
+ using that endpoint. Because of various transitive includes in uv.h,
+ including windows.h on Windows, uv.h must be included before other system
+ headers. Therefore, sockaddr.h must always be included first */
+#include "src/core/lib/iomgr/sockaddr.h"
+
#include <errno.h>
#include <string.h>
@@ -114,7 +120,6 @@
#include "src/core/ext/lb_policy/grpclb/grpclb.h"
#include "src/core/ext/lb_policy/grpclb/load_balancer_api.h"
#include "src/core/lib/channel/channel_args.h"
-#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/surface/call.h"
@@ -412,7 +417,7 @@ static grpc_lb_addresses *process_serverlist(
gpr_log(GPR_ERROR,
"Missing LB token for backend address '%s'. The empty token will "
"be used instead",
- grpc_sockaddr_to_uri((struct sockaddr *)&addr.addr));
+ grpc_sockaddr_to_uri(&addr));
user_data = GRPC_MDELEM_LB_TOKEN_EMPTY;
}
@@ -629,14 +634,12 @@ static grpc_lb_policy *glb_create(grpc_exec_ctx *exec_ctx,
}
if (addresses->addresses[i].is_balancer) {
if (addr_index == 0) {
- addr_strs[addr_index++] = grpc_sockaddr_to_uri(
- (const struct sockaddr *)&addresses->addresses[i].address.addr);
+ addr_strs[addr_index++] =
+ grpc_sockaddr_to_uri(&addresses->addresses[i].address);
} else {
- GPR_ASSERT(
- grpc_sockaddr_to_string(
- &addr_strs[addr_index++],
- (const struct sockaddr *)&addresses->addresses[i].address.addr,
- true) > 0);
+ GPR_ASSERT(grpc_sockaddr_to_string(
+ &addr_strs[addr_index++],
+ &addresses->addresses[i].address, true) > 0);
}
}
}
diff --git a/src/core/ext/lb_policy/pick_first/pick_first.c b/src/core/ext/lb_policy/pick_first/pick_first.c
index da4341d30d..5d3433df74 100644
--- a/src/core/ext/lb_policy/pick_first/pick_first.c
+++ b/src/core/ext/lb_policy/pick_first/pick_first.c
@@ -473,8 +473,7 @@ static grpc_lb_policy *create_pick_first(grpc_exec_ctx *exec_ctx,
/* server_name will be copied as part of the subchannel creation. This makes
* the copying of server_name (a borrowed pointer) OK. */
sc_args.server_name = server_name;
- sc_args.addr = (struct sockaddr *)(&addresses->addresses[i].address.addr);
- sc_args.addr_len = addresses->addresses[i].address.len;
+ sc_args.addr = &addresses->addresses[i].address;
sc_args.args = args->args;
grpc_subchannel *subchannel = grpc_client_channel_factory_create_subchannel(
diff --git a/src/core/ext/lb_policy/round_robin/round_robin.c b/src/core/ext/lb_policy/round_robin/round_robin.c
index b2676a7c86..c0743b00e8 100644
--- a/src/core/ext/lb_policy/round_robin/round_robin.c
+++ b/src/core/ext/lb_policy/round_robin/round_robin.c
@@ -635,8 +635,7 @@ static grpc_lb_policy *round_robin_create(grpc_exec_ctx *exec_ctx,
/* server_name will be copied as part of the subchannel creation. This makes
* the copying of server_name (a borrowed pointer) OK. */
sc_args.server_name = server_name;
- sc_args.addr = (struct sockaddr *)(&addresses->addresses[i].address.addr);
- sc_args.addr_len = addresses->addresses[i].address.len;
+ sc_args.addr = &addresses->addresses[i].address;
sc_args.args = args->args;
grpc_subchannel *subchannel = grpc_client_channel_factory_create_subchannel(