aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lib')
-rw-r--r--src/core/lib/channel/channel_stack.c18
-rw-r--r--src/core/lib/channel/channel_stack.h22
-rw-r--r--src/core/lib/channel/connected_channel.c19
-rw-r--r--src/core/lib/http/httpcli.c31
-rw-r--r--src/core/lib/http/httpcli.h7
-rw-r--r--src/core/lib/iomgr/pops.c103
-rw-r--r--src/core/lib/iomgr/pops.h69
-rw-r--r--src/core/lib/security/client_auth_filter.c26
-rw-r--r--src/core/lib/security/credentials.c62
-rw-r--r--src/core/lib/security/credentials.h12
-rw-r--r--src/core/lib/security/google_default_credentials.c28
-rw-r--r--src/core/lib/security/jwt_verifier.c12
-rw-r--r--src/core/lib/surface/call.c34
-rw-r--r--src/core/lib/transport/transport.c23
-rw-r--r--src/core/lib/transport/transport.h11
15 files changed, 312 insertions, 165 deletions
diff --git a/src/core/lib/channel/channel_stack.c b/src/core/lib/channel/channel_stack.c
index e02c164aaf..cedc8ade82 100644
--- a/src/core/lib/channel/channel_stack.c
+++ b/src/core/lib/channel/channel_stack.c
@@ -189,32 +189,30 @@ void grpc_call_stack_init(grpc_exec_ctx *exec_ctx,
}
}
-void grpc_call_stack_set_pollset_or_pollset_set(
- grpc_exec_ctx *exec_ctx, grpc_call_stack *call_stack, grpc_pollset *pollset,
- grpc_pollset_set *pollset_set_alternative) {
+void grpc_call_stack_set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx,
+ grpc_call_stack *call_stack,
+ grpc_pops *pops) {
size_t count = call_stack->count;
grpc_call_element *call_elems;
char *user_data;
size_t i;
- GPR_ASSERT((pollset == NULL) + (pollset_set_alternative == NULL) == 1);
- GPR_ASSERT(pollset != NULL || pollset_set_alternative != NULL);
call_elems = CALL_ELEMS_FROM_STACK(call_stack);
user_data = ((char *)call_elems) +
ROUND_UP_TO_ALIGNMENT_SIZE(count * sizeof(grpc_call_element));
/* init per-filter data */
for (i = 0; i < count; i++) {
- call_elems[i].filter->set_pollset_or_pollset_set(
- exec_ctx, &call_elems[i], pollset, pollset_set_alternative);
+ call_elems[i].filter->set_pollset_or_pollset_set(exec_ctx, &call_elems[i],
+ pops);
user_data +=
ROUND_UP_TO_ALIGNMENT_SIZE(call_elems[i].filter->sizeof_call_data);
}
}
-void grpc_call_stack_ignore_set_pollset_or_pollset_set(
- grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_pollset *pollset,
- grpc_pollset_set *pollset_set_alternative) {}
+void grpc_call_stack_ignore_set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx,
+ grpc_call_element *elem,
+ grpc_pops *pops) {}
void grpc_call_stack_destroy(grpc_exec_ctx *exec_ctx, grpc_call_stack *stack) {
grpc_call_element *elems = CALL_ELEMS_FROM_STACK(stack);
diff --git a/src/core/lib/channel/channel_stack.h b/src/core/lib/channel/channel_stack.h
index 027bb23c1d..c9d13ef193 100644
--- a/src/core/lib/channel/channel_stack.h
+++ b/src/core/lib/channel/channel_stack.h
@@ -46,6 +46,7 @@
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include "src/core/lib/debug/trace.h"
+#include "src/core/lib/iomgr/pops.h"
#include "src/core/lib/transport/transport.h"
typedef struct grpc_channel_element grpc_channel_element;
@@ -102,9 +103,7 @@ typedef struct {
void (*init_call_elem)(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
grpc_call_element_args *args);
void (*set_pollset_or_pollset_set)(grpc_exec_ctx *exec_ctx,
- grpc_call_element *elem,
- grpc_pollset *pollset,
- grpc_pollset_set *pollset_set_alternative);
+ grpc_call_element *elem, grpc_pops *pops);
/* Destroy per call data.
The filter does not need to do any chaining */
void (*destroy_call_elem)(grpc_exec_ctx *exec_ctx, grpc_call_element *elem);
@@ -201,9 +200,9 @@ void grpc_call_stack_init(grpc_exec_ctx *exec_ctx,
grpc_call_stack *call_stack);
/* Set a pollset or a pollset_set for a call stack: must occur before the first
* op is started */
-void grpc_call_stack_set_pollset_or_pollset_set(
- grpc_exec_ctx *exec_ctx, grpc_call_stack *call_stack, grpc_pollset *pollset,
- grpc_pollset_set *pollset_set_alternative);
+void grpc_call_stack_set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx,
+ grpc_call_stack *call_stack,
+ grpc_pops *pops);
#ifdef GRPC_STREAM_REFCOUNT_DEBUG
#define GRPC_CALL_STACK_REF(call_stack, reason) \
@@ -228,12 +227,11 @@ void grpc_call_stack_set_pollset_or_pollset_set(
/* Destroy a call stack */
void grpc_call_stack_destroy(grpc_exec_ctx *exec_ctx, grpc_call_stack *stack);
-/* Ignore set pollset{_set} - used by filters to implement the
- * set_pollset_or_pollset_set method if they don't care about pollsets at all.
- * Does nothing. */
-void grpc_call_stack_ignore_set_pollset_or_pollset_set(
- grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_pollset *pollset,
- grpc_pollset_set *pollset_set_alternative);
+/* Ignore set pollset{_set} - used by filters if they don't care about pollsets
+ * at all. Does nothing. */
+void grpc_call_stack_ignore_set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx,
+ grpc_call_element *elem,
+ grpc_pops *pops);
/* Call the next operation in a call stack */
void grpc_call_next_op(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
grpc_transport_stream_op *op);
diff --git a/src/core/lib/channel/connected_channel.c b/src/core/lib/channel/connected_channel.c
index 405f0a2ecd..314ff6e5ce 100644
--- a/src/core/lib/channel/connected_channel.c
+++ b/src/core/lib/channel/connected_channel.c
@@ -93,22 +93,13 @@ static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
GPR_ASSERT(r == 0);
}
-static void set_pollset_or_pollset_set(
- grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_pollset *pollset,
- grpc_pollset_set *pollset_set_alternative) {
- GPR_ASSERT((pollset == NULL) + (pollset_set_alternative == NULL) == 1);
- GPR_ASSERT(pollset != NULL || pollset_set_alternative != NULL);
-
+static void set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx,
+ grpc_call_element *elem,
+ grpc_pops *pops) {
call_data *calld = elem->call_data;
channel_data *chand = elem->channel_data;
- if (pollset != NULL) {
- grpc_transport_set_pollset(exec_ctx, chand->transport,
- TRANSPORT_STREAM_FROM_CALL_DATA(calld), pollset);
- } else if (pollset_set_alternative != NULL) {
- grpc_transport_set_pollset_set(exec_ctx, chand->transport,
- TRANSPORT_STREAM_FROM_CALL_DATA(calld),
- pollset_set_alternative);
- }
+ grpc_transport_set_pops(exec_ctx, chand->transport,
+ TRANSPORT_STREAM_FROM_CALL_DATA(calld), pops);
}
/* Destructor for call_data */
diff --git a/src/core/lib/http/httpcli.c b/src/core/lib/http/httpcli.c
index 4cf3358680..d48e954479 100644
--- a/src/core/lib/http/httpcli.c
+++ b/src/core/lib/http/httpcli.c
@@ -62,7 +62,7 @@ typedef struct {
grpc_httpcli_response_cb on_response;
void *user_data;
grpc_httpcli_context *context;
- grpc_pollset_set *pollset_set;
+ grpc_pops *pops;
grpc_iomgr_object iomgr_obj;
gpr_slice_buffer incoming;
gpr_slice_buffer outgoing;
@@ -97,8 +97,7 @@ static void next_address(grpc_exec_ctx *exec_ctx, internal_request *req);
static void finish(grpc_exec_ctx *exec_ctx, internal_request *req,
int success) {
- grpc_pollset_set_del_pollset_set(exec_ctx, req->context->pollset_set,
- req->pollset_set);
+ grpc_pops_del_to_pollset_set(exec_ctx, req->pops, req->context->pollset_set);
req->on_response(exec_ctx, req->user_data,
success ? &req->parser.http.response : NULL);
grpc_http_parser_destroy(&req->parser);
@@ -221,10 +220,10 @@ static void on_resolved(grpc_exec_ctx *exec_ctx, void *arg,
}
static void internal_request_begin(
- grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
- grpc_pollset_set *pollset_set, const grpc_httpcli_request *request,
- gpr_timespec deadline, grpc_httpcli_response_cb on_response,
- void *user_data, const char *name, gpr_slice request_text) {
+ grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context, grpc_pops *pops,
+ const grpc_httpcli_request *request, gpr_timespec deadline,
+ grpc_httpcli_response_cb on_response, void *user_data, const char *name,
+ gpr_slice request_text) {
internal_request *req = gpr_malloc(sizeof(internal_request));
memset(req, 0, sizeof(*req));
req->request_text = request_text;
@@ -235,7 +234,7 @@ static void internal_request_begin(
req->handshaker =
request->handshaker ? request->handshaker : &grpc_httpcli_plaintext;
req->context = context;
- req->pollset_set = pollset_set;
+ req->pops = pops;
grpc_closure_init(&req->on_read, on_read, req);
grpc_closure_init(&req->done_write, done_write, req);
gpr_slice_buffer_init(&req->incoming);
@@ -244,15 +243,14 @@ static void internal_request_begin(
req->host = gpr_strdup(request->host);
req->ssl_host_override = gpr_strdup(request->ssl_host_override);
- grpc_pollset_set_add_pollset_set(exec_ctx, req->context->pollset_set,
- req->pollset_set);
+ GPR_ASSERT(pops);
+ grpc_pops_add_to_pollset_set(exec_ctx, req->pops, req->context->pollset_set);
grpc_resolve_address(exec_ctx, request->host, req->handshaker->default_port,
on_resolved, req);
}
void grpc_httpcli_get(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
- grpc_pollset_set *pollset_set,
- const grpc_httpcli_request *request,
+ grpc_pops *pops, const grpc_httpcli_request *request,
gpr_timespec deadline,
grpc_httpcli_response_cb on_response, void *user_data) {
char *name;
@@ -261,15 +259,14 @@ void grpc_httpcli_get(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
return;
}
gpr_asprintf(&name, "HTTP:GET:%s:%s", request->host, request->http.path);
- internal_request_begin(exec_ctx, context, pollset_set, request, deadline,
+ internal_request_begin(exec_ctx, context, pops, request, deadline,
on_response, user_data, name,
grpc_httpcli_format_get_request(request));
gpr_free(name);
}
void grpc_httpcli_post(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
- grpc_pollset_set *pollset_set,
- const grpc_httpcli_request *request,
+ grpc_pops *pops, const grpc_httpcli_request *request,
const char *body_bytes, size_t body_size,
gpr_timespec deadline,
grpc_httpcli_response_cb on_response, void *user_data) {
@@ -281,8 +278,8 @@ void grpc_httpcli_post(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
}
gpr_asprintf(&name, "HTTP:POST:%s:%s", request->host, request->http.path);
internal_request_begin(
- exec_ctx, context, pollset_set, request, deadline, on_response, user_data,
- name, grpc_httpcli_format_post_request(request, body_bytes, body_size));
+ exec_ctx, context, pops, request, deadline, on_response, user_data, name,
+ grpc_httpcli_format_post_request(request, body_bytes, body_size));
gpr_free(name);
}
diff --git a/src/core/lib/http/httpcli.h b/src/core/lib/http/httpcli.h
index 040b5f4761..1166cfeea7 100644
--- a/src/core/lib/http/httpcli.h
+++ b/src/core/lib/http/httpcli.h
@@ -42,6 +42,7 @@
#include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/iomgr/iomgr_internal.h"
#include "src/core/lib/iomgr/pollset_set.h"
+#include "src/core/lib/iomgr/pops.h"
/* User agent this library reports */
#define GRPC_HTTPCLI_USER_AGENT "grpc-httpcli/0.0"
@@ -100,8 +101,7 @@ void grpc_httpcli_context_destroy(grpc_httpcli_context *context);
'on_response' is a callback to report results to (and 'user_data' is a user
supplied pointer to pass to said call) */
void grpc_httpcli_get(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
- grpc_pollset_set *pollset_set,
- const grpc_httpcli_request *request,
+ grpc_pops *pops, const grpc_httpcli_request *request,
gpr_timespec deadline,
grpc_httpcli_response_cb on_response, void *user_data);
@@ -121,8 +121,7 @@ void grpc_httpcli_get(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
supplied pointer to pass to said call)
Does not support ?var1=val1&var2=val2 in the path. */
void grpc_httpcli_post(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
- grpc_pollset_set *pollset_set,
- const grpc_httpcli_request *request,
+ grpc_pops *pops, const grpc_httpcli_request *request,
const char *body_bytes, size_t body_size,
gpr_timespec deadline,
grpc_httpcli_response_cb on_response, void *user_data);
diff --git a/src/core/lib/iomgr/pops.c b/src/core/lib/iomgr/pops.c
new file mode 100644
index 0000000000..c2629f20aa
--- /dev/null
+++ b/src/core/lib/iomgr/pops.c
@@ -0,0 +1,103 @@
+/*
+ *
+ * Copyright 2016, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+
+#include "src/core/lib/iomgr/pops.h"
+
+struct grpc_pops {
+ union {
+ grpc_pollset *pollset;
+ grpc_pollset_set *pollset_set;
+ } pops;
+ enum pops_tag { POLLSET, POLLSET_SET } tag;
+};
+
+grpc_pops *grpc_pops_create_from_pollset_set(grpc_pollset_set *pollset_set) {
+ grpc_pops *pops = gpr_malloc(sizeof(grpc_pops));
+ pops->pops.pollset_set = pollset_set;
+ pops->tag = POLLSET_SET;
+ return pops;
+}
+
+grpc_pops *grpc_pops_create_from_pollset(grpc_pollset *pollset) {
+ grpc_pops *pops = gpr_malloc(sizeof(grpc_pops));
+ pops->pops.pollset = pollset;
+ pops->tag = POLLSET;
+ return pops;
+}
+
+void grpc_pops_destroy(grpc_pops *pops) { gpr_free(pops); }
+
+grpc_pollset *grpc_pops_pollset(grpc_pops *pops) {
+ if (pops->tag == POLLSET) {
+ return pops->pops.pollset;
+ }
+ return NULL;
+}
+
+grpc_pollset_set *grpc_pops_pollset_set(grpc_pops *pops) {
+ if (pops->tag == POLLSET_SET) {
+ return pops->pops.pollset_set;
+ }
+ return NULL;
+}
+
+void grpc_pops_add_to_pollset_set(grpc_exec_ctx *exec_ctx, grpc_pops *pops,
+ grpc_pollset_set *pss_dst) {
+ if (pops->tag == POLLSET) {
+ GPR_ASSERT(pops->pops.pollset != NULL);
+ grpc_pollset_set_add_pollset(exec_ctx, pss_dst, pops->pops.pollset);
+ } else if (pops->tag == POLLSET_SET) {
+ GPR_ASSERT(pops->pops.pollset_set != NULL);
+ grpc_pollset_set_add_pollset_set(exec_ctx, pss_dst, pops->pops.pollset_set);
+ } else {
+ gpr_log(GPR_ERROR, "Invalid grpc_pops tag '%d'", pops->tag);
+ abort();
+ }
+}
+
+void grpc_pops_del_to_pollset_set(grpc_exec_ctx *exec_ctx, grpc_pops *pops,
+ grpc_pollset_set *pss_dst) {
+ if (pops->tag == POLLSET) {
+ GPR_ASSERT(pops->pops.pollset != NULL);
+ grpc_pollset_set_del_pollset(exec_ctx, pss_dst, pops->pops.pollset);
+ } else if (pops->tag == POLLSET_SET) {
+ GPR_ASSERT(pops->pops.pollset_set != NULL);
+ grpc_pollset_set_del_pollset_set(exec_ctx, pss_dst, pops->pops.pollset_set);
+ } else {
+ gpr_log(GPR_ERROR, "Invalid grpc_pops tag '%d'", pops->tag);
+ abort();
+ }
+}
diff --git a/src/core/lib/iomgr/pops.h b/src/core/lib/iomgr/pops.h
new file mode 100644
index 0000000000..24ff85748b
--- /dev/null
+++ b/src/core/lib/iomgr/pops.h
@@ -0,0 +1,69 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_IOMGR_POPS_H
+#define GRPC_CORE_LIB_IOMGR_POPS_H
+
+#include "src/core/lib/iomgr/pollset.h"
+#include "src/core/lib/iomgr/pollset_set.h"
+
+/* A grpc_pops is a pollset-or-pollset_set container. It allows functions that
+ * accept a pollset XOR a pollset_set to do so through an abstract interface.
+ * No ownership is taken. */
+
+typedef struct grpc_pops grpc_pops;
+
+grpc_pops *grpc_pops_create_from_pollset_set(grpc_pollset_set *pollset_set);
+grpc_pops *grpc_pops_create_from_pollset(grpc_pollset *pollset);
+
+/** If \a pops contains a pollset, return it. Otherwise, return NULL */
+grpc_pollset *grpc_pops_pollset(grpc_pops *pops);
+
+/** If \a pops contains a pollset_set, return it. Otherwise, return NULL */
+grpc_pollset_set *grpc_pops_pollset_set(grpc_pops *pops);
+
+void grpc_pops_destroy(grpc_pops *pops);
+
+/** Add the pollset or pollset_set in \a pops to the destination pollset_set \a
+ * pss_dst */
+void grpc_pops_add_to_pollset_set(grpc_exec_ctx *exec_ctx, grpc_pops *pops,
+ grpc_pollset_set *pss_dst);
+
+/** Delete the pollset or pollset_set in \a pops from the destination
+ * pollset_set \a
+ * pss_dst */
+void grpc_pops_del_to_pollset_set(grpc_exec_ctx *exec_ctx, grpc_pops *pops,
+ grpc_pollset_set *pss_dst);
+/* pollset_set specific */
+
+#endif /* GRPC_CORE_LIB_IOMGR_POPS_H */
diff --git a/src/core/lib/security/client_auth_filter.c b/src/core/lib/security/client_auth_filter.c
index 5db9755c2b..1511659dfe 100644
--- a/src/core/lib/security/client_auth_filter.c
+++ b/src/core/lib/security/client_auth_filter.c
@@ -54,11 +54,11 @@ typedef struct {
grpc_call_credentials *creds;
grpc_mdstr *host;
grpc_mdstr *method;
- /* pollset_set bound to this call; if we need to make external
+ /* pollset{_set} bound to this call; if we need to make external
network requests, they should be done under a pollset added to this
pollset_set so that work can progress when this call wants work to progress
*/
- grpc_pollset_set *pollset_set;
+ grpc_pops *pops;
grpc_transport_stream_op op;
uint8_t security_context_set;
grpc_linked_mdelem md_links[MAX_CREDENTIALS_METADATA_COUNT];
@@ -184,9 +184,9 @@ static void send_security_metadata(grpc_exec_ctx *exec_ctx,
build_auth_metadata_context(&chand->security_connector->base,
chand->auth_context, calld);
calld->op = *op; /* Copy op (originates from the caller's stack). */
- GPR_ASSERT(calld->pollset_set);
+ GPR_ASSERT(calld->pops != NULL);
grpc_call_credentials_get_request_metadata(
- exec_ctx, calld->creds, calld->pollset_set, calld->auth_md_context,
+ exec_ctx, calld->creds, calld->pops, calld->auth_md_context,
on_credentials_metadata, elem);
}
@@ -268,22 +268,13 @@ static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
grpc_call_element_args *args) {
call_data *calld = elem->call_data;
memset(calld, 0, sizeof(*calld));
- calld->pollset_set = grpc_pollset_set_create();
}
-static void set_pollset_or_pollset_set(
- grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_pollset *pollset,
- grpc_pollset_set *pollset_set_alternative) {
- GPR_ASSERT((pollset == NULL) + (pollset_set_alternative == NULL) == 1);
- GPR_ASSERT(pollset != NULL || pollset_set_alternative != NULL);
-
+static void set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx,
+ grpc_call_element *elem,
+ grpc_pops *pops) {
call_data *calld = elem->call_data;
- if (pollset != NULL) {
- grpc_pollset_set_add_pollset(exec_ctx, calld->pollset_set, pollset);
- } else if (pollset_set_alternative != NULL) {
- grpc_pollset_set_add_pollset_set(exec_ctx, calld->pollset_set,
- pollset_set_alternative);
- }
+ calld->pops = pops;
}
/* Destructor for call_data */
@@ -298,7 +289,6 @@ static void destroy_call_elem(grpc_exec_ctx *exec_ctx,
GRPC_MDSTR_UNREF(calld->method);
}
reset_auth_metadata_context(&calld->auth_md_context);
- grpc_pollset_set_destroy(calld->pollset_set);
}
/* Constructor for channel_data */
diff --git a/src/core/lib/security/credentials.c b/src/core/lib/security/credentials.c
index 8550649cbf..43c061a265 100644
--- a/src/core/lib/security/credentials.c
+++ b/src/core/lib/security/credentials.c
@@ -117,16 +117,16 @@ void grpc_call_credentials_release(grpc_call_credentials *creds) {
}
void grpc_call_credentials_get_request_metadata(
- grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds,
- grpc_pollset_set *pollset_set, grpc_auth_metadata_context context,
- grpc_credentials_metadata_cb cb, void *user_data) {
+ grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds, grpc_pops *pops,
+ grpc_auth_metadata_context context, grpc_credentials_metadata_cb cb,
+ void *user_data) {
if (creds == NULL || creds->vtable->get_request_metadata == NULL) {
if (cb != NULL) {
cb(exec_ctx, user_data, NULL, 0, GRPC_CREDENTIALS_OK);
}
return;
}
- creds->vtable->get_request_metadata(exec_ctx, creds, pollset_set, context, cb,
+ creds->vtable->get_request_metadata(exec_ctx, creds, pops, context, cb,
user_data);
}
@@ -448,7 +448,7 @@ static void jwt_destruct(grpc_call_credentials *creds) {
static void jwt_get_request_metadata(grpc_exec_ctx *exec_ctx,
grpc_call_credentials *creds,
- grpc_pollset_set *pollset_set,
+ grpc_pops *pops,
grpc_auth_metadata_context context,
grpc_credentials_metadata_cb cb,
void *user_data) {
@@ -670,9 +670,9 @@ static void on_oauth2_token_fetcher_http_response(
}
static void oauth2_token_fetcher_get_request_metadata(
- grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds,
- grpc_pollset_set *pollset_set, grpc_auth_metadata_context context,
- grpc_credentials_metadata_cb cb, void *user_data) {
+ grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds, grpc_pops *pops,
+ grpc_auth_metadata_context context, grpc_credentials_metadata_cb cb,
+ void *user_data) {
grpc_oauth2_token_fetcher_credentials *c =
(grpc_oauth2_token_fetcher_credentials *)creds;
gpr_timespec refresh_threshold = gpr_time_from_seconds(
@@ -697,7 +697,7 @@ static void oauth2_token_fetcher_get_request_metadata(
c->fetch_func(
exec_ctx,
grpc_credentials_metadata_request_create(creds, cb, user_data),
- &c->httpcli_context, pollset_set, on_oauth2_token_fetcher_http_response,
+ &c->httpcli_context, pops, on_oauth2_token_fetcher_http_response,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), refresh_threshold));
}
}
@@ -720,7 +720,7 @@ static grpc_call_credentials_vtable compute_engine_vtable = {
static void compute_engine_fetch_oauth2(
grpc_exec_ctx *exec_ctx, grpc_credentials_metadata_request *metadata_req,
- grpc_httpcli_context *httpcli_context, grpc_pollset_set *pollset_set,
+ grpc_httpcli_context *httpcli_context, grpc_pops *pops,
grpc_httpcli_response_cb response_cb, gpr_timespec deadline) {
grpc_http_header header = {"Metadata-Flavor", "Google"};
grpc_httpcli_request request;
@@ -729,7 +729,7 @@ static void compute_engine_fetch_oauth2(
request.http.path = GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH;
request.http.hdr_count = 1;
request.http.hdrs = &header;
- grpc_httpcli_get(exec_ctx, httpcli_context, pollset_set, &request, deadline,
+ grpc_httpcli_get(exec_ctx, httpcli_context, pops, &request, deadline,
response_cb, metadata_req);
}
@@ -759,7 +759,7 @@ static grpc_call_credentials_vtable refresh_token_vtable = {
static void refresh_token_fetch_oauth2(
grpc_exec_ctx *exec_ctx, grpc_credentials_metadata_request *metadata_req,
- grpc_httpcli_context *httpcli_context, grpc_pollset_set *pollset_set,
+ grpc_httpcli_context *httpcli_context, grpc_pops *pops,
grpc_httpcli_response_cb response_cb, gpr_timespec deadline) {
grpc_google_refresh_token_credentials *c =
(grpc_google_refresh_token_credentials *)metadata_req->creds;
@@ -776,7 +776,7 @@ static void refresh_token_fetch_oauth2(
request.http.hdr_count = 1;
request.http.hdrs = &header;
request.handshaker = &grpc_httpcli_ssl;
- grpc_httpcli_post(exec_ctx, httpcli_context, pollset_set, &request, body,
+ grpc_httpcli_post(exec_ctx, httpcli_context, pops, &request, body,
strlen(body), deadline, response_cb, metadata_req);
gpr_free(body);
}
@@ -826,9 +826,9 @@ static void on_simulated_token_fetch_done(grpc_exec_ctx *exec_ctx,
}
static void md_only_test_get_request_metadata(
- grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds,
- grpc_pollset_set *pollset_set, grpc_auth_metadata_context context,
- grpc_credentials_metadata_cb cb, void *user_data) {
+ grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds, grpc_pops *pops,
+ grpc_auth_metadata_context context, grpc_credentials_metadata_cb cb,
+ void *user_data) {
grpc_md_only_test_credentials *c = (grpc_md_only_test_credentials *)creds;
if (c->is_async) {
@@ -866,9 +866,9 @@ static void access_token_destruct(grpc_call_credentials *creds) {
}
static void access_token_get_request_metadata(
- grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds,
- grpc_pollset_set *pollset_set, grpc_auth_metadata_context context,
- grpc_credentials_metadata_cb cb, void *user_data) {
+ grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds, grpc_pops *pops,
+ grpc_auth_metadata_context context, grpc_credentials_metadata_cb cb,
+ void *user_data) {
grpc_access_token_credentials *c = (grpc_access_token_credentials *)creds;
cb(exec_ctx, user_data, c->access_token_md->entries, 1, GRPC_CREDENTIALS_OK);
}
@@ -951,7 +951,7 @@ typedef struct {
grpc_credentials_md_store *md_elems;
grpc_auth_metadata_context auth_md_context;
void *user_data;
- grpc_pollset_set *pollset_set;
+ grpc_pops *pops;
grpc_credentials_metadata_cb cb;
} grpc_composite_call_credentials_metadata_context;
@@ -994,9 +994,9 @@ static void composite_call_metadata_cb(grpc_exec_ctx *exec_ctx, void *user_data,
if (ctx->creds_index < ctx->composite_creds->inner.num_creds) {
grpc_call_credentials *inner_creds =
ctx->composite_creds->inner.creds_array[ctx->creds_index++];
- grpc_call_credentials_get_request_metadata(
- exec_ctx, inner_creds, ctx->pollset_set, ctx->auth_md_context,
- composite_call_metadata_cb, ctx);
+ grpc_call_credentials_get_request_metadata(exec_ctx, inner_creds, ctx->pops,
+ ctx->auth_md_context,
+ composite_call_metadata_cb, ctx);
return;
}
@@ -1007,9 +1007,9 @@ static void composite_call_metadata_cb(grpc_exec_ctx *exec_ctx, void *user_data,
}
static void composite_call_get_request_metadata(
- grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds,
- grpc_pollset_set *pollset_set, grpc_auth_metadata_context auth_md_context,
- grpc_credentials_metadata_cb cb, void *user_data) {
+ grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds, grpc_pops *pops,
+ grpc_auth_metadata_context auth_md_context, grpc_credentials_metadata_cb cb,
+ void *user_data) {
grpc_composite_call_credentials *c = (grpc_composite_call_credentials *)creds;
grpc_composite_call_credentials_metadata_context *ctx;
@@ -1019,11 +1019,11 @@ static void composite_call_get_request_metadata(
ctx->user_data = user_data;
ctx->cb = cb;
ctx->composite_creds = c;
- ctx->pollset_set = pollset_set;
+ ctx->pops = pops;
ctx->md_elems = grpc_credentials_md_store_create(c->inner.num_creds);
grpc_call_credentials_get_request_metadata(
- exec_ctx, c->inner.creds_array[ctx->creds_index++], pollset_set,
- auth_md_context, composite_call_metadata_cb, ctx);
+ exec_ctx, c->inner.creds_array[ctx->creds_index++], pops, auth_md_context,
+ composite_call_metadata_cb, ctx);
}
static grpc_call_credentials_vtable composite_call_credentials_vtable = {
@@ -1116,7 +1116,7 @@ static void iam_destruct(grpc_call_credentials *creds) {
static void iam_get_request_metadata(grpc_exec_ctx *exec_ctx,
grpc_call_credentials *creds,
- grpc_pollset_set *pollset_set,
+ grpc_pops *pops,
grpc_auth_metadata_context context,
grpc_credentials_metadata_cb cb,
void *user_data) {
@@ -1205,7 +1205,7 @@ static void plugin_md_request_metadata_ready(void *request,
static void plugin_get_request_metadata(grpc_exec_ctx *exec_ctx,
grpc_call_credentials *creds,
- grpc_pollset_set *pollset_set,
+ grpc_pops *pops,
grpc_auth_metadata_context context,
grpc_credentials_metadata_cb cb,
void *user_data) {
diff --git a/src/core/lib/security/credentials.h b/src/core/lib/security/credentials.h
index 9512e8e028..3d374949d5 100644
--- a/src/core/lib/security/credentials.h
+++ b/src/core/lib/security/credentials.h
@@ -41,6 +41,7 @@
#include "src/core/lib/http/httpcli.h"
#include "src/core/lib/http/parser.h"
+#include "src/core/lib/iomgr/pops.h"
#include "src/core/lib/security/json_token.h"
#include "src/core/lib/security/security_connector.h"
@@ -169,8 +170,7 @@ typedef void (*grpc_credentials_metadata_cb)(grpc_exec_ctx *exec_ctx,
typedef struct {
void (*destruct)(grpc_call_credentials *c);
void (*get_request_metadata)(grpc_exec_ctx *exec_ctx,
- grpc_call_credentials *c,
- grpc_pollset_set *pollset_set,
+ grpc_call_credentials *c, grpc_pops *pops,
grpc_auth_metadata_context context,
grpc_credentials_metadata_cb cb,
void *user_data);
@@ -185,9 +185,9 @@ struct grpc_call_credentials {
grpc_call_credentials *grpc_call_credentials_ref(grpc_call_credentials *creds);
void grpc_call_credentials_unref(grpc_call_credentials *creds);
void grpc_call_credentials_get_request_metadata(
- grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds,
- grpc_pollset_set *pollset_set, grpc_auth_metadata_context context,
- grpc_credentials_metadata_cb cb, void *user_data);
+ grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds, grpc_pops *pops,
+ grpc_auth_metadata_context context, grpc_credentials_metadata_cb cb,
+ void *user_data);
typedef struct {
grpc_call_credentials **creds_array;
@@ -318,7 +318,7 @@ typedef struct grpc_credentials_metadata_request
typedef void (*grpc_fetch_oauth2_func)(grpc_exec_ctx *exec_ctx,
grpc_credentials_metadata_request *req,
grpc_httpcli_context *http_context,
- grpc_pollset_set *pollset_set,
+ grpc_pops *pops,
grpc_httpcli_response_cb response_cb,
gpr_timespec deadline);
diff --git a/src/core/lib/security/google_default_credentials.c b/src/core/lib/security/google_default_credentials.c
index d831a986b2..29045f36eb 100644
--- a/src/core/lib/security/google_default_credentials.c
+++ b/src/core/lib/security/google_default_credentials.c
@@ -41,6 +41,7 @@
#include "src/core/lib/http/httpcli.h"
#include "src/core/lib/http/parser.h"
+#include "src/core/lib/iomgr/pops.h"
#include "src/core/lib/support/env.h"
#include "src/core/lib/support/load_file.h"
#include "src/core/lib/surface/api_trace.h"
@@ -60,8 +61,7 @@ static gpr_once g_once = GPR_ONCE_INIT;
static void init_default_credentials(void) { gpr_mu_init(&g_state_mu); }
typedef struct {
- grpc_pollset *pollset;
- grpc_pollset_set *pollset_set;
+ grpc_pops *pops;
int is_done;
int success;
} compute_engine_detector;
@@ -85,7 +85,7 @@ static void on_compute_engine_detection_http_response(
}
gpr_mu_lock(g_polling_mu);
detector->is_done = 1;
- grpc_pollset_kick(detector->pollset, NULL);
+ grpc_pollset_kick(grpc_pops_pollset(detector->pops), NULL);
gpr_mu_unlock(g_polling_mu);
}
@@ -104,11 +104,9 @@ static int is_stack_running_on_compute_engine(void) {
on compute engine. */
gpr_timespec max_detection_delay = gpr_time_from_seconds(1, GPR_TIMESPAN);
- detector.pollset = gpr_malloc(grpc_pollset_size());
- grpc_pollset_init(detector.pollset, &g_polling_mu);
- detector.pollset_set = grpc_pollset_set_create();
- grpc_pollset_set_add_pollset(&exec_ctx, detector.pollset_set,
- detector.pollset);
+ grpc_pollset *pollset = gpr_malloc(grpc_pollset_size());
+ grpc_pollset_init(pollset, &g_polling_mu);
+ detector.pops = grpc_pops_create_from_pollset(pollset);
detector.is_done = 0;
detector.success = 0;
@@ -119,7 +117,7 @@ static int is_stack_running_on_compute_engine(void) {
grpc_httpcli_context_init(&context);
grpc_httpcli_get(
- &exec_ctx, &context, detector.pollset_set, &request,
+ &exec_ctx, &context, detector.pops, &request,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), max_detection_delay),
on_compute_engine_detection_http_response, &detector);
@@ -130,20 +128,22 @@ static int is_stack_running_on_compute_engine(void) {
gpr_mu_lock(g_polling_mu);
while (!detector.is_done) {
grpc_pollset_worker *worker = NULL;
- grpc_pollset_work(&exec_ctx, detector.pollset, &worker,
+ grpc_pollset_work(&exec_ctx, grpc_pops_pollset(detector.pops), &worker,
gpr_now(GPR_CLOCK_MONOTONIC),
gpr_inf_future(GPR_CLOCK_MONOTONIC));
}
gpr_mu_unlock(g_polling_mu);
grpc_httpcli_context_destroy(&context);
- grpc_closure_init(&destroy_closure, destroy_pollset, detector.pollset);
- grpc_pollset_shutdown(&exec_ctx, detector.pollset, &destroy_closure);
- grpc_pollset_set_destroy(detector.pollset_set);
+ grpc_closure_init(&destroy_closure, destroy_pollset,
+ grpc_pops_pollset(detector.pops));
+ grpc_pollset_shutdown(&exec_ctx, grpc_pops_pollset(detector.pops),
+ &destroy_closure);
grpc_exec_ctx_finish(&exec_ctx);
g_polling_mu = NULL;
- gpr_free(detector.pollset);
+ gpr_free(grpc_pops_pollset(detector.pops));
+ grpc_pops_destroy(detector.pops);
return detector.success;
}
diff --git a/src/core/lib/security/jwt_verifier.c b/src/core/lib/security/jwt_verifier.c
index f764596aa9..a5d200d7a3 100644
--- a/src/core/lib/security/jwt_verifier.c
+++ b/src/core/lib/security/jwt_verifier.c
@@ -37,6 +37,7 @@
#include <string.h>
#include "src/core/lib/http/httpcli.h"
+#include "src/core/lib/iomgr/pops.h"
#include "src/core/lib/security/b64.h"
#include "src/core/lib/tsi/ssl_types.h"
@@ -321,7 +322,7 @@ grpc_jwt_verifier_status grpc_jwt_claims_check(const grpc_jwt_claims *claims,
typedef struct {
grpc_jwt_verifier *verifier;
- grpc_pollset_set *pollset_set;
+ grpc_pops *pops;
jose_header *header;
grpc_jwt_claims *claims;
char *audience;
@@ -341,8 +342,7 @@ static verifier_cb_ctx *verifier_cb_ctx_create(
verifier_cb_ctx *ctx = gpr_malloc(sizeof(verifier_cb_ctx));
memset(ctx, 0, sizeof(verifier_cb_ctx));
ctx->verifier = verifier;
- ctx->pollset_set = grpc_pollset_set_create();
- grpc_pollset_set_add_pollset(&exec_ctx, ctx->pollset_set, pollset);
+ ctx->pops = grpc_pops_create_from_pollset(pollset);
ctx->header = header;
ctx->audience = gpr_strdup(audience);
ctx->claims = claims;
@@ -360,7 +360,7 @@ void verifier_cb_ctx_destroy(verifier_cb_ctx *ctx) {
gpr_slice_unref(ctx->signature);
gpr_slice_unref(ctx->signed_data);
jose_header_destroy(ctx->header);
- grpc_pollset_set_destroy(ctx->pollset_set);
+ grpc_pops_destroy(ctx->pops);
/* TODO: see what to do with claims... */
gpr_free(ctx);
}
@@ -646,7 +646,7 @@ static void on_openid_config_retrieved(grpc_exec_ctx *exec_ctx, void *user_data,
*(req.host + (req.http.path - jwks_uri)) = '\0';
}
grpc_httpcli_get(
- exec_ctx, &ctx->verifier->http_ctx, ctx->pollset_set, &req,
+ exec_ctx, &ctx->verifier->http_ctx, ctx->pops, &req,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), grpc_jwt_verifier_max_delay),
on_keys_retrieved, ctx);
grpc_json_destroy(json);
@@ -749,7 +749,7 @@ static void retrieve_key_and_verify(grpc_exec_ctx *exec_ctx,
}
grpc_httpcli_get(
- exec_ctx, &ctx->verifier->http_ctx, ctx->pollset_set, &req,
+ exec_ctx, &ctx->verifier->http_ctx, ctx->pops, &req,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), grpc_jwt_verifier_max_delay),
http_cb, ctx);
gpr_free(req.host);
diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c
index 899784e2c2..4b5a7d7465 100644
--- a/src/core/lib/surface/call.c
+++ b/src/core/lib/surface/call.c
@@ -135,7 +135,7 @@ typedef struct batch_control {
struct grpc_call {
grpc_completion_queue *cq;
- grpc_pollset_set *pollset_set;
+ grpc_pops *pops;
grpc_channel *channel;
grpc_call *parent;
grpc_call *first_child;
@@ -259,13 +259,6 @@ grpc_call *grpc_call_create(
gpr_mu_init(&call->mu);
call->channel = channel;
call->cq = cq;
- if (cq != NULL && pollset_set_alternative != NULL) {
- gpr_log(
- GPR_ERROR,
- "Only one of 'cq' and 'pollset_set_alternative' should be non-NULL.");
- abort();
- }
- call->pollset_set = pollset_set_alternative;
call->parent = parent_call;
call->is_client = server_transport_data == NULL;
if (call->is_client) {
@@ -290,14 +283,18 @@ grpc_call *grpc_call_create(
call->context, server_transport_data,
CALL_STACK_FROM_CALL(call));
if (cq != NULL) {
+ GPR_ASSERT(
+ pollset_set_alternative == NULL &&
+ "Only one of 'cq' and 'pollset_set_alternative' should be non-NULL.");
GRPC_CQ_INTERNAL_REF(cq, "bind");
- grpc_call_stack_set_pollset_or_pollset_set(
- &exec_ctx, CALL_STACK_FROM_CALL(call), grpc_cq_pollset(cq), NULL);
+ call->pops = grpc_pops_create_from_pollset(grpc_cq_pollset(cq));
}
if (pollset_set_alternative != NULL) {
- GPR_ASSERT(cq == NULL);
+ call->pops = grpc_pops_create_from_pollset_set(pollset_set_alternative);
+ }
+ if (call->pops != NULL) {
grpc_call_stack_set_pollset_or_pollset_set(
- &exec_ctx, CALL_STACK_FROM_CALL(call), NULL, pollset_set_alternative);
+ &exec_ctx, CALL_STACK_FROM_CALL(call), call->pops);
}
if (parent_call != NULL) {
GRPC_CALL_INTERNAL_REF(parent_call, "child");
@@ -352,11 +349,19 @@ grpc_call *grpc_call_create(
void grpc_call_set_completion_queue(grpc_exec_ctx *exec_ctx, grpc_call *call,
grpc_completion_queue *cq) {
GPR_ASSERT(cq);
- GPR_ASSERT(call->pollset_set == NULL);
+
+ if (call->pops != NULL && grpc_pops_pollset_set(call->pops) != NULL) {
+ gpr_log(GPR_ERROR, "A pollset_set is already registered for this call.");
+ abort();
+ }
call->cq = cq;
GRPC_CQ_INTERNAL_REF(cq, "bind");
+ if (call->pops != NULL) {
+ grpc_pops_destroy(call->pops);
+ }
+ call->pops = grpc_pops_create_from_pollset(grpc_cq_pollset(cq));
grpc_call_stack_set_pollset_or_pollset_set(
- exec_ctx, CALL_STACK_FROM_CALL(call), grpc_cq_pollset(cq), NULL);
+ exec_ctx, CALL_STACK_FROM_CALL(call), call->pops);
}
#ifdef GRPC_STREAM_REFCOUNT_DEBUG
@@ -404,6 +409,7 @@ static void destroy_call(grpc_exec_ctx *exec_ctx, void *call, bool success) {
if (c->cq) {
GRPC_CQ_INTERNAL_UNREF(c->cq, "bind");
}
+ grpc_pops_destroy(c->pops);
gpr_free(c);
GPR_TIMER_END("destroy_call", 0);
}
diff --git a/src/core/lib/transport/transport.c b/src/core/lib/transport/transport.c
index 7f2ae5f52e..ba39693e47 100644
--- a/src/core/lib/transport/transport.c
+++ b/src/core/lib/transport/transport.c
@@ -125,17 +125,18 @@ void grpc_transport_perform_op(grpc_exec_ctx *exec_ctx,
transport->vtable->perform_op(exec_ctx, transport, op);
}
-void grpc_transport_set_pollset(grpc_exec_ctx *exec_ctx,
- grpc_transport *transport, grpc_stream *stream,
- grpc_pollset *pollset) {
- transport->vtable->set_pollset(exec_ctx, transport, stream, pollset);
-}
-
-void grpc_transport_set_pollset_set(grpc_exec_ctx *exec_ctx,
- grpc_transport *transport,
- grpc_stream *stream,
- grpc_pollset_set *pollset_set) {
- transport->vtable->set_pollset_set(exec_ctx, transport, stream, pollset_set);
+void grpc_transport_set_pops(grpc_exec_ctx *exec_ctx, grpc_transport *transport,
+ grpc_stream *stream, grpc_pops *pops) {
+ grpc_pollset *pollset;
+ grpc_pollset_set *pollset_set;
+ if ((pollset = grpc_pops_pollset(pops)) != NULL) {
+ transport->vtable->set_pollset(exec_ctx, transport, stream, pollset);
+ } else if ((pollset_set = grpc_pops_pollset_set(pops)) != NULL) {
+ transport->vtable->set_pollset_set(exec_ctx, transport, stream,
+ pollset_set);
+ } else {
+ abort();
+ }
}
void grpc_transport_destroy_stream(grpc_exec_ctx *exec_ctx,
diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h
index 8f0c2d9023..0be080c9ca 100644
--- a/src/core/lib/transport/transport.h
+++ b/src/core/lib/transport/transport.h
@@ -39,6 +39,7 @@
#include "src/core/lib/channel/context.h"
#include "src/core/lib/iomgr/pollset.h"
#include "src/core/lib/iomgr/pollset_set.h"
+#include "src/core/lib/iomgr/pops.h"
#include "src/core/lib/transport/byte_stream.h"
#include "src/core/lib/transport/metadata_batch.h"
@@ -197,14 +198,8 @@ int grpc_transport_init_stream(grpc_exec_ctx *exec_ctx,
grpc_stream_refcount *refcount,
const void *server_data);
-void grpc_transport_set_pollset(grpc_exec_ctx *exec_ctx,
- grpc_transport *transport, grpc_stream *stream,
- grpc_pollset *pollset);
-
-void grpc_transport_set_pollset_set(grpc_exec_ctx *exec_ctx,
- grpc_transport *transport,
- grpc_stream *stream,
- grpc_pollset_set *pollset_set);
+void grpc_transport_set_pops(grpc_exec_ctx *exec_ctx, grpc_transport *transport,
+ grpc_stream *stream, grpc_pops *pops);
/* Destroy transport data for a stream.