aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/end2end/fixtures/h2_uchannel.c
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-03-07 20:08:24 -0800
committerGravatar Craig Tiller <ctiller@google.com>2016-03-07 20:08:24 -0800
commit41cb61de8b53d59247ff0007aadac0b7f314988f (patch)
tree31477e895e6f69317648d380f050ec73ab80a3a0 /test/core/end2end/fixtures/h2_uchannel.c
parentbd137fb1a7956cfccc1a814420fbcfc83504750c (diff)
parentdba948569a90fa12b4d024555e559c1abfc75607 (diff)
Merge github.com:grpc/grpc into filter-selection
Diffstat (limited to 'test/core/end2end/fixtures/h2_uchannel.c')
-rw-r--r--test/core/end2end/fixtures/h2_uchannel.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/test/core/end2end/fixtures/h2_uchannel.c b/test/core/end2end/fixtures/h2_uchannel.c
index cc04937abc..74915f81df 100644
--- a/test/core/end2end/fixtures/h2_uchannel.c
+++ b/test/core/end2end/fixtures/h2_uchannel.c
@@ -35,6 +35,13 @@
#include <string.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/host_port.h>
+#include <grpc/support/log.h>
+#include <grpc/support/string_util.h>
+#include <grpc/support/sync.h>
+#include <grpc/support/thd.h>
+#include <grpc/support/useful.h>
#include "src/core/channel/channel_args.h"
#include "src/core/channel/client_channel.h"
#include "src/core/channel/client_uchannel.h"
@@ -46,13 +53,6 @@
#include "src/core/surface/channel.h"
#include "src/core/surface/server.h"
#include "src/core/transport/chttp2_transport.h"
-#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
-#include <grpc/support/log.h>
-#include <grpc/support/string_util.h>
-#include <grpc/support/sync.h>
-#include <grpc/support/thd.h>
-#include <grpc/support/useful.h>
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
@@ -229,12 +229,12 @@ static grpc_end2end_test_fixture chttp2_create_fixture_micro_fullstack(
}
grpc_connectivity_state g_state = GRPC_CHANNEL_IDLE;
-grpc_pollset_set g_interested_parties;
+grpc_pollset_set *g_interested_parties;
static void state_changed(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
if (g_state != GRPC_CHANNEL_READY) {
grpc_subchannel_notify_on_state_change(
- exec_ctx, arg, &g_interested_parties, &g_state,
+ exec_ctx, arg, g_interested_parties, &g_state,
grpc_closure_create(state_changed, arg));
}
}
@@ -244,30 +244,31 @@ static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
}
static grpc_connected_subchannel *connect_subchannel(grpc_subchannel *c) {
- grpc_pollset pollset;
+ gpr_mu *mu;
+ grpc_pollset *pollset = gpr_malloc(grpc_pollset_size());
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_pollset_init(&pollset);
- grpc_pollset_set_init(&g_interested_parties);
- grpc_pollset_set_add_pollset(&exec_ctx, &g_interested_parties, &pollset);
- grpc_subchannel_notify_on_state_change(&exec_ctx, c, &g_interested_parties,
+ grpc_pollset_init(pollset, &mu);
+ g_interested_parties = grpc_pollset_set_create();
+ grpc_pollset_set_add_pollset(&exec_ctx, g_interested_parties, pollset);
+ grpc_subchannel_notify_on_state_change(&exec_ctx, c, g_interested_parties,
&g_state,
grpc_closure_create(state_changed, c));
grpc_exec_ctx_flush(&exec_ctx);
- gpr_mu_lock(GRPC_POLLSET_MU(&pollset));
+ gpr_mu_lock(mu);
while (g_state != GRPC_CHANNEL_READY) {
grpc_pollset_worker *worker = NULL;
- grpc_pollset_work(&exec_ctx, &pollset, &worker,
- gpr_now(GPR_CLOCK_MONOTONIC),
+ grpc_pollset_work(&exec_ctx, pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1));
- gpr_mu_unlock(GRPC_POLLSET_MU(&pollset));
+ gpr_mu_unlock(mu);
grpc_exec_ctx_flush(&exec_ctx);
- gpr_mu_lock(GRPC_POLLSET_MU(&pollset));
+ gpr_mu_lock(mu);
}
- grpc_pollset_shutdown(&exec_ctx, &pollset,
- grpc_closure_create(destroy_pollset, &pollset));
- grpc_pollset_set_destroy(&g_interested_parties);
- gpr_mu_unlock(GRPC_POLLSET_MU(&pollset));
+ grpc_pollset_shutdown(&exec_ctx, pollset,
+ grpc_closure_create(destroy_pollset, pollset));
+ grpc_pollset_set_destroy(g_interested_parties);
+ gpr_mu_unlock(mu);
grpc_exec_ctx_finish(&exec_ctx);
+ gpr_free(pollset);
return grpc_subchannel_get_connected_subchannel(c);
}