Skip to content

Commit

Permalink
Use const qualified SSLContext
Browse files Browse the repository at this point in the history
Summary: Use const qualified ssl context.

Reviewed By: hanidamlaj

Differential Revision: D51903797

fbshipit-source-id: 67be8ed73ece3203aea8eb766e17c4a23a55b774
  • Loading branch information
abakiaydin authored and facebook-github-bot committed Dec 8, 2023
1 parent c38d55b commit fd1bccb
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 31 deletions.
2 changes: 1 addition & 1 deletion proxygen/lib/http/HTTPConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void HTTPConnector::connect(EventBase* eventBase,

void HTTPConnector::connectSSL(EventBase* eventBase,
const folly::SocketAddress& connectAddr,
const shared_ptr<SSLContext>& context,
const shared_ptr<const SSLContext>& context,
std::shared_ptr<folly::ssl::SSLSession> session,
std::chrono::milliseconds timeoutMs,
const SocketOptionMap& socketOptions,
Expand Down
2 changes: 1 addition & 1 deletion proxygen/lib/http/HTTPConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class HTTPConnector : protected folly::AsyncSocket::ConnectCallback {
void connectSSL(
folly::EventBase* eventBase,
const folly::SocketAddress& connectAddr,
const std::shared_ptr<folly::SSLContext>& ctx,
const std::shared_ptr<const folly::SSLContext>& ctx,
std::shared_ptr<folly::ssl::SSLSession> session = nullptr,
std::chrono::milliseconds timeoutMs = std::chrono::milliseconds(0),
const folly::SocketOptionMap& socketOptions = folly::emptySocketOptionMap,
Expand Down
15 changes: 8 additions & 7 deletions proxygen/lib/http/session/HQDownstreamSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@ bool HQDownstreamSession::isDetachable(bool) const {
return false;
}

void HQDownstreamSession::attachThreadLocals(folly::EventBase*,
folly::SSLContextPtr,
const WheelTimerInstance&,
HTTPSessionStats*,
FilterIteratorFn,
HeaderCodec::Stats*,
HTTPSessionController*) {
void HQDownstreamSession::attachThreadLocals(
folly::EventBase*,
std::shared_ptr<const folly::SSLContext>,
const WheelTimerInstance&,
HTTPSessionStats*,
FilterIteratorFn,
HeaderCodec::Stats*,
HTTPSessionController*) {
LOG(FATAL) << __func__ << " is an upstream interface";
}

Expand Down
2 changes: 1 addition & 1 deletion proxygen/lib/http/session/HQDownstreamSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class HQDownstreamSession : public HQSession {
bool isDetachable(bool) const override;

void attachThreadLocals(folly::EventBase*,
folly::SSLContextPtr,
std::shared_ptr<const folly::SSLContext>,
const WheelTimerInstance&,
HTTPSessionStats*,
FilterIteratorFn,
Expand Down
15 changes: 8 additions & 7 deletions proxygen/lib/http/session/HQUpstreamSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,14 @@ bool HQUpstreamSession::isDetachable(bool checkSocket) const {
return getNumOutgoingStreams() == 0 && getNumIncomingStreams() == 0;
}

void HQUpstreamSession::attachThreadLocals(folly::EventBase* eventBase,
folly::SSLContextPtr,
const WheelTimerInstance& timeout,
HTTPSessionStats* stats,
FilterIteratorFn fn,
HeaderCodec::Stats* headerCodecStats,
HTTPSessionController* controller) {
void HQUpstreamSession::attachThreadLocals(
folly::EventBase* eventBase,
std::shared_ptr<const folly::SSLContext>,
const WheelTimerInstance& timeout,
HTTPSessionStats* stats,
FilterIteratorFn fn,
HeaderCodec::Stats* headerCodecStats,
HTTPSessionController* controller) {
// TODO: deal with control streams in h2q
VLOG(4) << __func__ << " sess=" << *this;
txnEgressQueue_.attachThreadLocals(timeout);
Expand Down
2 changes: 1 addition & 1 deletion proxygen/lib/http/session/HQUpstreamSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class HQUpstreamSession : public HQSession {
bool isDetachable(bool checkSocket) const override;

void attachThreadLocals(folly::EventBase*,
folly::SSLContextPtr,
std::shared_ptr<const folly::SSLContext>,
const WheelTimerInstance&,
HTTPSessionStats*,
FilterIteratorFn,
Expand Down
2 changes: 1 addition & 1 deletion proxygen/lib/http/session/HTTPDownstreamSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class HTTPDownstreamSession final : public HTTPSession {
}

void attachThreadLocals(folly::EventBase*,
folly::SSLContextPtr,
std::shared_ptr<const folly::SSLContext>,
const WheelTimerInstance&,
HTTPSessionStats*,
FilterIteratorFn,
Expand Down
15 changes: 8 additions & 7 deletions proxygen/lib/http/session/HTTPSessionBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -473,13 +473,14 @@ class HTTPSessionBase : public wangle::ManagedConnection {

virtual bool isDetachable(bool checkSocket) const = 0;

virtual void attachThreadLocals(folly::EventBase* eventBase,
folly::SSLContextPtr sslContext,
const WheelTimerInstance& wheelTimer,
HTTPSessionStats* stats,
FilterIteratorFn fn,
HeaderCodec::Stats* headerCodecStats,
HTTPSessionController* controller) = 0;
virtual void attachThreadLocals(
folly::EventBase* eventBase,
std::shared_ptr<const folly::SSLContext> sslContext,
const WheelTimerInstance& wheelTimer,
HTTPSessionStats* stats,
FilterIteratorFn fn,
HeaderCodec::Stats* headerCodecStats,
HTTPSessionController* controller) = 0;

virtual void detachThreadLocals(bool detachSSLContext = false) = 0;

Expand Down
4 changes: 2 additions & 2 deletions proxygen/lib/http/session/HTTPUpstreamSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ bool HTTPUpstreamSession::onNativeProtocolUpgrade(

void HTTPUpstreamSession::attachThreadLocals(
folly::EventBase* eventBase,
folly::SSLContextPtr sslContext,
std::shared_ptr<const folly::SSLContext> sslContext,
const WheelTimerInstance& wheelTimer,
HTTPSessionStats* stats,
FilterIteratorFn fn,
Expand All @@ -198,7 +198,7 @@ void HTTPUpstreamSession::attachThreadLocals(
}

void HTTPUpstreamSession::maybeAttachSSLContext(
folly::SSLContextPtr sslContext) const {
std::shared_ptr<const folly::SSLContext> sslContext) const {
#ifndef NO_ASYNCSSLSOCKET
auto sslSocket = sock_->getUnderlyingTransport<folly::AsyncSSLSocket>();
if (sslSocket && sslContext) {
Expand Down
5 changes: 3 additions & 2 deletions proxygen/lib/http/session/HTTPUpstreamSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class HTTPUpstreamSession : public HTTPSession {
using FilterIteratorFn = std::function<void(HTTPCodecFilter*)>;

void attachThreadLocals(folly::EventBase* eventBase,
folly::SSLContextPtr sslContext,
std::shared_ptr<const folly::SSLContext> sslContext,
const WheelTimerInstance& wheelTimer,
HTTPSessionStats* stats,
FilterIteratorFn fn,
Expand Down Expand Up @@ -167,7 +167,8 @@ class HTTPUpstreamSession : public HTTPSession {
const std::string& protocolString,
HTTPMessage& msg) override;

void maybeAttachSSLContext(folly::SSLContextPtr sslContext) const;
void maybeAttachSSLContext(
std::shared_ptr<const folly::SSLContext> sslContext) const;
void maybeDetachSSLContext() const;

uint8_t maxVirtualPriorityLevel_{0};
Expand Down
2 changes: 1 addition & 1 deletion proxygen/lib/http/session/test/HQSessionMocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class MockHQSession : public HQSession {
}

void attachThreadLocals(folly::EventBase*,
folly::SSLContextPtr,
std::shared_ptr<const folly::SSLContext>,
const WheelTimerInstance&,
HTTPSessionStats*,
FilterIteratorFn,
Expand Down

0 comments on commit fd1bccb

Please sign in to comment.