1
1
#pragma once
2
2
3
+ #include < memory>
3
4
#include < queue>
4
5
5
6
#include " envoy/api/api.h"
@@ -128,6 +129,8 @@ class GoogleStub {
128
129
grpc::CompletionQueue* cq) PURE;
129
130
};
130
131
132
+ using GoogleStubSharedPtr = std::shared_ptr<GoogleStub>;
133
+
131
134
class GoogleGenericStub : public GoogleStub {
132
135
public:
133
136
GoogleGenericStub (std::shared_ptr<grpc::Channel> channel) : stub_(channel) {}
@@ -148,12 +151,12 @@ class GoogleStubFactory {
148
151
virtual ~GoogleStubFactory () = default ;
149
152
150
153
// Create a stub from a given channel.
151
- virtual std::shared_ptr<GoogleStub> createStub (std::shared_ptr<grpc::Channel> channel) PURE;
154
+ virtual GoogleStubSharedPtr createStub (std::shared_ptr<grpc::Channel> channel) PURE;
152
155
};
153
156
154
157
class GoogleGenericStubFactory : public GoogleStubFactory {
155
158
public:
156
- std::shared_ptr<GoogleStub> createStub (std::shared_ptr<grpc::Channel> channel) override {
159
+ GoogleStubSharedPtr createStub (std::shared_ptr<grpc::Channel> channel) override {
157
160
return std::make_shared<GoogleGenericStub>(channel);
158
161
}
159
162
};
@@ -185,7 +188,7 @@ class GoogleAsyncClientImpl final : public RawAsyncClient, Logger::Loggable<Logg
185
188
// This is shared with child streams, so that they can cleanup independent of
186
189
// the client if it gets destructed. The streams need to wait for their tags
187
190
// to drain from the CQ.
188
- std::shared_ptr<GoogleStub> stub_;
191
+ GoogleStubSharedPtr stub_;
189
192
std::list<std::unique_ptr<GoogleAsyncStreamImpl>> active_streams_;
190
193
const std::string stat_prefix_;
191
194
const Protobuf::RepeatedPtrField<envoy::config::core::v3::HeaderValue> initial_metadata_;
@@ -272,7 +275,7 @@ class GoogleAsyncStreamImpl : public RawAsyncStream,
272
275
Event::Dispatcher& dispatcher_;
273
276
// We hold a ref count on the stub_ to allow the stream to wait for its tags
274
277
// to drain from the CQ on cleanup.
275
- std::shared_ptr<GoogleStub> stub_;
278
+ GoogleStubSharedPtr stub_;
276
279
std::string service_full_name_;
277
280
std::string method_name_;
278
281
RawAsyncStreamCallbacks& callbacks_;
0 commit comments