aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-05-08 09:52:54 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-05-08 09:52:54 -0700
commit928cd7710f6289586729f19488d275d02284601c (patch)
tree5a43fec4c507a2067ea079bf7f97b59d8821fd68
parentfe4ba36625c8870e1d24f2c7bb67ec4e53f5f957 (diff)
Plumb pollset_set through setup pipeline
-rw-r--r--src/core/channel/client_channel.c7
-rw-r--r--src/core/channel/client_setup.c5
-rw-r--r--src/core/transport/transport.c5
-rw-r--r--src/core/transport/transport.h7
4 files changed, 15 insertions, 9 deletions
diff --git a/src/core/channel/client_channel.c b/src/core/channel/client_channel.c
index 43a793f39e..6c21ca34ef 100644
--- a/src/core/channel/client_channel.c
+++ b/src/core/channel/client_channel.c
@@ -212,6 +212,7 @@ static void cc_start_transport_op(grpc_call_element *elem,
if (!chand->transport_setup_initiated) {
chand->transport_setup_initiated = 1;
initiate_transport_setup = 1;
+ grpc_pollset_set_init(&chand->waiting_pollsets);
}
/* add this call to the waiting set to be resumed once we have a child
channel stack, growing the waiting set if needed */
@@ -222,9 +223,6 @@ static void cc_start_transport_op(grpc_call_element *elem,
chand->waiting_children,
chand->waiting_child_capacity * sizeof(call_data *));
}
- if (chand->waiting_child_count == 0) {
- grpc_pollset_set_init(&chand->waiting_pollsets);
- }
grpc_pollset_set_add_pollset(&chand->waiting_pollsets, op->bind_pollset);
calld->s.waiting_op = *op;
chand->waiting_children[chand->waiting_child_count++] = calld;
@@ -232,7 +230,8 @@ static void cc_start_transport_op(grpc_call_element *elem,
/* finally initiate transport setup if needed */
if (initiate_transport_setup) {
- grpc_transport_setup_initiate(chand->transport_setup);
+ grpc_transport_setup_initiate(chand->transport_setup,
+ &chand->waiting_pollsets);
}
}
}
diff --git a/src/core/channel/client_setup.c b/src/core/channel/client_setup.c
index 6d892d6c92..3d0f48696c 100644
--- a/src/core/channel/client_setup.c
+++ b/src/core/channel/client_setup.c
@@ -61,6 +61,7 @@ struct grpc_client_setup {
struct grpc_client_setup_request {
/* pointer back to the setup object */
grpc_client_setup *setup;
+ grpc_pollset_set *interested_parties;
gpr_timespec deadline;
};
@@ -77,12 +78,14 @@ static void destroy_setup(grpc_client_setup *s) {
}
/* initiate handshaking */
-static void setup_initiate(grpc_transport_setup *sp) {
+static void setup_initiate(grpc_transport_setup *sp,
+ grpc_pollset_set *interested_parties) {
grpc_client_setup *s = (grpc_client_setup *)sp;
grpc_client_setup_request *r = gpr_malloc(sizeof(grpc_client_setup_request));
int in_alarm = 0;
r->setup = s;
+ r->interested_parties = interested_parties;
/* TODO(klempner): Actually set a deadline */
r->deadline = gpr_inf_future;
diff --git a/src/core/transport/transport.c b/src/core/transport/transport.c
index d9a1319c42..b30b13d297 100644
--- a/src/core/transport/transport.c
+++ b/src/core/transport/transport.c
@@ -82,8 +82,9 @@ void grpc_transport_setup_cancel(grpc_transport_setup *setup) {
setup->vtable->cancel(setup);
}
-void grpc_transport_setup_initiate(grpc_transport_setup *setup) {
- setup->vtable->initiate(setup);
+void grpc_transport_setup_initiate(grpc_transport_setup *setup,
+ grpc_pollset_set *interested_parties) {
+ setup->vtable->initiate(setup, interested_parties);
}
void grpc_transport_op_finish_with_failure(grpc_transport_op *op) {
diff --git a/src/core/transport/transport.h b/src/core/transport/transport.h
index 7a389ea393..ef1bda8d90 100644
--- a/src/core/transport/transport.h
+++ b/src/core/transport/transport.h
@@ -37,6 +37,7 @@
#include <stddef.h>
#include "src/core/iomgr/pollset.h"
+#include "src/core/iomgr/pollset_set.h"
#include "src/core/transport/stream_op.h"
/* forward declarations */
@@ -193,7 +194,8 @@ typedef struct grpc_transport_setup grpc_transport_setup;
typedef struct grpc_transport_setup_vtable grpc_transport_setup_vtable;
struct grpc_transport_setup_vtable {
- void (*initiate)(grpc_transport_setup *setup);
+ void (*initiate)(grpc_transport_setup *setup,
+ grpc_pollset_set *interested_parties);
void (*cancel)(grpc_transport_setup *setup);
};
@@ -209,7 +211,8 @@ struct grpc_transport_setup {
setup construction time.
This *may* be implemented as a no-op if the setup process monitors something
continuously. */
-void grpc_transport_setup_initiate(grpc_transport_setup *setup);
+void grpc_transport_setup_initiate(grpc_transport_setup *setup,
+ grpc_pollset_set *interested_parties);
/* Cancel transport setup. After this returns, no new transports should be
created, and all pending transport setup callbacks should be completed.
After this call completes, setup should be considered invalid (this can be