ソースを参照

Get ephemeral connections working again

Craig Tiller 10 年 前
コミット
53ee0407bb

+ 2 - 0
src/core/client_config/subchannel.c

@@ -590,6 +590,7 @@ static void subchannel_call_destroy(grpc_exec_ctx *exec_ctx, void *call,
   grpc_subchannel_call *c = call;
   grpc_subchannel_call *c = call;
   GPR_TIMER_BEGIN("grpc_subchannel_call_unref.destroy", 0);
   GPR_TIMER_BEGIN("grpc_subchannel_call_unref.destroy", 0);
   grpc_call_stack_destroy(exec_ctx, SUBCHANNEL_CALL_TO_CALL_STACK(c));
   grpc_call_stack_destroy(exec_ctx, SUBCHANNEL_CALL_TO_CALL_STACK(c));
+  GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, c->connection, "subchannel_call");
   gpr_free(c);
   gpr_free(c);
   GPR_TIMER_END("grpc_subchannel_call_unref.destroy", 0);
   GPR_TIMER_END("grpc_subchannel_call_unref.destroy", 0);
 }
 }
@@ -633,6 +634,7 @@ grpc_subchannel_call *grpc_connected_subchannel_create_call(
       gpr_malloc(sizeof(grpc_subchannel_call) + chanstk->call_stack_size);
       gpr_malloc(sizeof(grpc_subchannel_call) + chanstk->call_stack_size);
   grpc_call_stack *callstk = SUBCHANNEL_CALL_TO_CALL_STACK(call);
   grpc_call_stack *callstk = SUBCHANNEL_CALL_TO_CALL_STACK(call);
   call->connection = con;
   call->connection = con;
+  GRPC_CONNECTED_SUBCHANNEL_REF(con, "subchannel_call");
   grpc_call_stack_init(exec_ctx, chanstk, 1, subchannel_call_destroy, call,
   grpc_call_stack_init(exec_ctx, chanstk, 1, subchannel_call_destroy, call,
                        NULL, NULL, callstk);
                        NULL, NULL, callstk);
   grpc_call_stack_set_pollset(exec_ctx, callstk, pollset);
   grpc_call_stack_set_pollset(exec_ctx, callstk, pollset);

+ 4 - 4
src/core/transport/connectivity_state.c

@@ -88,7 +88,7 @@ void grpc_connectivity_state_destroy(grpc_exec_ctx *exec_ctx,
 grpc_connectivity_state grpc_connectivity_state_check(
 grpc_connectivity_state grpc_connectivity_state_check(
     grpc_connectivity_state_tracker *tracker) {
     grpc_connectivity_state_tracker *tracker) {
   if (grpc_connectivity_state_trace) {
   if (grpc_connectivity_state_trace) {
-    gpr_log(GPR_DEBUG, "CONWATCH: %s: get %s", tracker->name,
+    gpr_log(GPR_DEBUG, "CONWATCH: %p %s: get %s", tracker, tracker->name,
             grpc_connectivity_state_name(tracker->current_state));
             grpc_connectivity_state_name(tracker->current_state));
   }
   }
   return tracker->current_state;
   return tracker->current_state;
@@ -98,8 +98,8 @@ int grpc_connectivity_state_notify_on_state_change(
     grpc_exec_ctx *exec_ctx, grpc_connectivity_state_tracker *tracker,
     grpc_exec_ctx *exec_ctx, grpc_connectivity_state_tracker *tracker,
     grpc_connectivity_state *current, grpc_closure *notify) {
     grpc_connectivity_state *current, grpc_closure *notify) {
   if (grpc_connectivity_state_trace) {
   if (grpc_connectivity_state_trace) {
-    gpr_log(GPR_DEBUG, "CONWATCH: %s: from %s [cur=%s] notify=%p",
-            tracker->name, grpc_connectivity_state_name(*current),
+    gpr_log(GPR_DEBUG, "CONWATCH: %p %s: from %s [cur=%s] notify=%p",
+            tracker, tracker->name, grpc_connectivity_state_name(*current),
             grpc_connectivity_state_name(tracker->current_state), notify);
             grpc_connectivity_state_name(tracker->current_state), notify);
   }
   }
   if (tracker->current_state != *current) {
   if (tracker->current_state != *current) {
@@ -142,7 +142,7 @@ void grpc_connectivity_state_set(grpc_exec_ctx *exec_ctx,
                                  const char *reason) {
                                  const char *reason) {
   grpc_connectivity_state_watcher *w;
   grpc_connectivity_state_watcher *w;
   if (grpc_connectivity_state_trace) {
   if (grpc_connectivity_state_trace) {
-    gpr_log(GPR_DEBUG, "SET: %s: %s --> %s [%s]", tracker->name,
+    gpr_log(GPR_DEBUG, "SET: %p %s: %s --> %s [%s]", tracker, tracker->name,
             grpc_connectivity_state_name(tracker->current_state),
             grpc_connectivity_state_name(tracker->current_state),
             grpc_connectivity_state_name(state), reason);
             grpc_connectivity_state_name(state), reason);
   }
   }