|
|
|
@ -38,6 +38,7 @@ |
|
|
|
|
#include "src/core/lib/channel/channel_args.h" |
|
|
|
|
#include "src/core/lib/channel/connected_channel.h" |
|
|
|
|
#include "src/core/lib/debug/stats.h" |
|
|
|
|
#include "src/core/lib/gpr/alloc.h" |
|
|
|
|
#include "src/core/lib/gprpp/debug_location.h" |
|
|
|
|
#include "src/core/lib/gprpp/manual_constructor.h" |
|
|
|
|
#include "src/core/lib/gprpp/ref_counted_ptr.h" |
|
|
|
@ -140,9 +141,13 @@ struct grpc_subchannel_call { |
|
|
|
|
grpc_closure* schedule_closure_after_destroy; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
#define SUBCHANNEL_CALL_TO_CALL_STACK(call) ((grpc_call_stack*)((call) + 1)) |
|
|
|
|
#define CALLSTACK_TO_SUBCHANNEL_CALL(callstack) \ |
|
|
|
|
(((grpc_subchannel_call*)(callstack)) - 1) |
|
|
|
|
#define SUBCHANNEL_CALL_TO_CALL_STACK(call) \ |
|
|
|
|
(grpc_call_stack*)((char*)(call) + GPR_ROUND_UP_TO_ALIGNMENT_SIZE( \
|
|
|
|
|
sizeof(grpc_subchannel_call))) |
|
|
|
|
#define CALLSTACK_TO_SUBCHANNEL_CALL(callstack) \ |
|
|
|
|
(grpc_subchannel_call*)(((char*)(call_stack)) - \
|
|
|
|
|
GPR_ROUND_UP_TO_ALIGNMENT_SIZE( \
|
|
|
|
|
sizeof(grpc_subchannel_call))) |
|
|
|
|
|
|
|
|
|
static void on_subchannel_connected(void* subchannel, grpc_error* error); |
|
|
|
|
|
|
|
|
@ -783,9 +788,17 @@ void ConnectedSubchannel::Ping(grpc_closure* on_initiate, |
|
|
|
|
|
|
|
|
|
grpc_error* ConnectedSubchannel::CreateCall(const CallArgs& args, |
|
|
|
|
grpc_subchannel_call** call) { |
|
|
|
|
*call = static_cast<grpc_subchannel_call*>(gpr_arena_alloc( |
|
|
|
|
args.arena, sizeof(grpc_subchannel_call) + |
|
|
|
|
channel_stack_->call_stack_size + args.parent_data_size)); |
|
|
|
|
size_t allocation_size = |
|
|
|
|
GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_subchannel_call)); |
|
|
|
|
if (args.parent_data_size > 0) { |
|
|
|
|
allocation_size += |
|
|
|
|
GPR_ROUND_UP_TO_ALIGNMENT_SIZE(channel_stack_->call_stack_size) + |
|
|
|
|
args.parent_data_size; |
|
|
|
|
} else { |
|
|
|
|
allocation_size += channel_stack_->call_stack_size; |
|
|
|
|
} |
|
|
|
|
*call = static_cast<grpc_subchannel_call*>( |
|
|
|
|
gpr_arena_alloc(args.arena, allocation_size)); |
|
|
|
|
grpc_call_stack* callstk = SUBCHANNEL_CALL_TO_CALL_STACK(*call); |
|
|
|
|
RefCountedPtr<ConnectedSubchannel> connection = |
|
|
|
|
Ref(DEBUG_LOCATION, "subchannel_call"); |
|
|
|
|