diff options
author | 2016-11-07 11:26:05 -0800 | |
---|---|---|
committer | 2016-11-07 11:26:05 -0800 | |
commit | 0e44a258cb532274aa67b09f0fbdffd75d6a6441 (patch) | |
tree | 51bdf4424c7d8e5916b7ec78c775220246fda19f /src/cpp/common/channel_filter.h | |
parent | c6a752d901ce2d7601e454a958cf38bf427bc91b (diff) |
Fix C++ filter API and add test for it.
Diffstat (limited to 'src/cpp/common/channel_filter.h')
-rw-r--r-- | src/cpp/common/channel_filter.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/cpp/common/channel_filter.h b/src/cpp/common/channel_filter.h index fc0deff3b3..e420efc71c 100644 --- a/src/cpp/common/channel_filter.h +++ b/src/cpp/common/channel_filter.h @@ -224,9 +224,13 @@ class ChannelData { const char *peer() const { return peer_; } // TODO(roth): Find a way to avoid passing elem into these methods. + virtual void StartTransportOp(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, TransportOp *op); + virtual void GetInfo(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, + const grpc_channel_info *channel_info); + protected: /// Takes ownership of \a peer. ChannelData(const grpc_channel_args &args, const char *peer) : peer_(peer) {} @@ -296,6 +300,13 @@ class ChannelFilter final { channel_data->StartTransportOp(exec_ctx, elem, &op_wrapper); } + static void GetChannelInfo(grpc_exec_ctx *exec_ctx, + grpc_channel_element *elem, + const grpc_channel_info *channel_info) { + ChannelDataType *channel_data = (ChannelDataType *)elem->channel_data; + channel_data->GetInfo(exec_ctx, elem, channel_info); + } + static const size_t call_data_size = sizeof(CallDataType); static grpc_error *InitCallElement(grpc_exec_ctx *exec_ctx, @@ -376,7 +387,8 @@ void RegisterChannelFilter( FilterType::call_data_size, FilterType::InitCallElement, FilterType::SetPollsetOrPollsetSet, FilterType::DestroyCallElement, FilterType::channel_data_size, FilterType::InitChannelElement, - FilterType::DestroyChannelElement, FilterType::GetPeer, name}}; + FilterType::DestroyChannelElement, FilterType::GetPeer, + FilterType::GetChannelInfo, name}}; internal::channel_filters->push_back(filter_record); } |