-
Notifications
You must be signed in to change notification settings - Fork 5.3k
http: moving functions and member variables out of http1 pool #13867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,7 +43,7 @@ class HttpConnPoolImplBase : public Envoy::ConnectionPool::ConnPoolImplBase, | |
| Event::Dispatcher& dispatcher, | ||
| const Network::ConnectionSocket::OptionsSharedPtr& options, | ||
| const Network::TransportSocketOptionsSharedPtr& transport_socket_options, | ||
| Http::Protocol protocol); | ||
| Random::RandomGenerator& random_generator, Http::Protocol protocol); | ||
|
|
||
| // ConnectionPool::Instance | ||
| void addDrainedCallback(DrainedCb cb) override { addDrainedCallbackImpl(cb); } | ||
|
|
@@ -55,6 +55,7 @@ class HttpConnPoolImplBase : public Envoy::ConnectionPool::ConnPoolImplBase, | |
| return Envoy::ConnectionPool::ConnPoolImplBase::maybePrefetch(ratio); | ||
| } | ||
| bool hasActiveConnections() const override; | ||
| Http::Protocol protocol() const override { return protocol_; } | ||
|
|
||
| // Creates a new PendingStream and enqueues it into the queue. | ||
| ConnectionPool::Cancellable* | ||
|
|
@@ -69,6 +70,10 @@ class HttpConnPoolImplBase : public Envoy::ConnectionPool::ConnPoolImplBase, | |
| Envoy::ConnectionPool::AttachContext& context) override; | ||
|
|
||
| virtual CodecClientPtr createCodecClient(Upstream::Host::CreateConnectionData& data) PURE; | ||
|
|
||
| protected: | ||
| Random::RandomGenerator& random_generator_; | ||
| Http::Protocol protocol_; | ||
| }; | ||
|
|
||
| // An implementation of Envoy::ConnectionPool::ActiveClient for HTTP/1.1 and HTTP/2 | ||
|
|
@@ -78,8 +83,15 @@ class ActiveClient : public Envoy::ConnectionPool::ActiveClient { | |
| uint64_t concurrent_stream_limit) | ||
| : Envoy::ConnectionPool::ActiveClient(parent, lifetime_stream_limit, | ||
| concurrent_stream_limit) { | ||
| Upstream::Host::CreateConnectionData data = parent_.host()->createConnection( | ||
| parent_.dispatcher(), parent_.socketOptions(), parent_.transportSocketOptions()); | ||
| // The static cast makes sure we call the base class host() and not | ||
| // HttpConnPoolImplBase::host which is of a different type. | ||
| Upstream::Host::CreateConnectionData data = | ||
| static_cast<Envoy::ConnectionPool::ConnPoolImplBase*>(&parent)->host()->createConnection( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's going on with this cast? Isn't this an upcast, and thus would happen implicitly?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Annoyingly, and the base class has so without the cast it snags the wrong type and complains there's no createConnection function.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yuck. Can you add a comment to that effect?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah - will add it to my clean up list too - may be able to do away with it with one of the later refactors! |
||
| parent.dispatcher(), parent.socketOptions(), parent.transportSocketOptions()); | ||
| initialize(data, parent); | ||
| } | ||
|
|
||
| void initialize(Upstream::Host::CreateConnectionData& data, HttpConnPoolImplBase& parent) { | ||
ggreenway marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| real_host_description_ = data.host_description_; | ||
| codec_client_ = parent.createCodecClient(data); | ||
| codec_client_->addConnectionCallbacks(*this); | ||
|
|
@@ -90,6 +102,7 @@ class ActiveClient : public Envoy::ConnectionPool::ActiveClient { | |
| parent_.host()->cluster().stats().upstream_cx_tx_bytes_buffered_, | ||
| &parent_.host()->cluster().stats().bind_errors_, nullptr}); | ||
| } | ||
|
|
||
| void close() override { codec_client_->close(); } | ||
| virtual Http::RequestEncoder& newStreamEncoder(Http::ResponseDecoder& response_decoder) PURE; | ||
| void onEvent(Network::ConnectionEvent event) override { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.