Commit a803ace4 authored by Viswanath Sivakumar's avatar Viswanath Sivakumar Committed by woo

Convert TransportInfo SSL fields to shared_ptrs

Summary:
We do a lot of copying of TransportInfo in proxygen, and in most cases
the SSL structs don't change after connection establishment. We could
cut down on memory usage by sharing these huge strings. This is
especially true with SPDY where all streams belonging to a session could
share these fields.

Facebook:

Test Plan: Unit tests, will canary

Reviewed By: afrind@fb.com

Subscribers: fugalh, bmatheny, ssl-diffs@, folly-diffs@, jsedgwick, woo

FB internal diff: D1807557

Tasks: 5343753

Signature: t1:1807557:1422472932:53038345fca620632097586fb9e410bca8fe748d
parent 80702b5d
......@@ -118,12 +118,16 @@ class AcceptorHandshakeHelper :
tinfo.sslVersion = sock->getSSLVersion();
tinfo.sslCertSize = sock->getSSLCertSize();
tinfo.sslResume = SSLUtil::getResumeState(sock);
sock->getSSLClientCiphers(tinfo.sslClientCiphers);
sock->getSSLServerCiphers(tinfo.sslServerCiphers);
tinfo.sslClientComprMethods = sock->getSSLClientComprMethods();
tinfo.sslClientExts = sock->getSSLClientExts();
tinfo.sslNextProtocol.assign(
reinterpret_cast<const char*>(nextProto),
tinfo.sslClientCiphers = std::make_shared<std::string>();
sock->getSSLClientCiphers(*tinfo.sslClientCiphers);
tinfo.sslServerCiphers = std::make_shared<std::string>();
sock->getSSLServerCiphers(*tinfo.sslServerCiphers);
tinfo.sslClientComprMethods =
std::make_shared<std::string>(sock->getSSLClientComprMethods());
tinfo.sslClientExts =
std::make_shared<std::string>(sock->getSSLClientExts());
tinfo.sslNextProtocol = std::make_shared<std::string>();
tinfo.sslNextProtocol->assign(reinterpret_cast<const char*>(nextProto),
nextProtoLength);
acceptor_->updateSSLStats(sock, tinfo.sslSetupTime, SSLErrorEnum::NO_ERROR);
......
......@@ -86,37 +86,37 @@ struct TransportInfo {
/*
* list of ciphers sent by the client
*/
std::string sslClientCiphers{};
std::shared_ptr<std::string> sslClientCiphers{nullptr};
/*
* list of compression methods sent by the client
*/
std::string sslClientComprMethods{};
std::shared_ptr<std::string> sslClientComprMethods{nullptr};
/*
* list of TLS extensions sent by the client
*/
std::string sslClientExts{};
std::shared_ptr<std::string> sslClientExts{nullptr};
/*
* hash of all the SSL parameters sent by the client
*/
std::string sslSignature{};
std::shared_ptr<std::string> sslSignature{nullptr};
/*
* list of ciphers supported by the server
*/
std::string sslServerCiphers{};
std::shared_ptr<std::string> sslServerCiphers{nullptr};
/*
* guessed "(os) (browser)" based on SSL Signature
*/
std::string guessedUserAgent{};
std::shared_ptr<std::string> guessedUserAgent{nullptr};
/**
* The result of SSL NPN negotiation.
*/
std::string sslNextProtocol{};
std::shared_ptr<std::string> sslNextProtocol{nullptr};
/*
* total number of bytes sent over the connection
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment