Commit cfa22893 authored by Anirudh Ramachandran's avatar Anirudh Ramachandran Committed by Facebook Github Bot

Track resumption status in HandshakeCallback

Summary: Helps test resumption failure/success in other tests that use AsyncSSLSocketTest classes.

Reviewed By: mingtaoy

Differential Revision: D18561383

fbshipit-source-id: 29852ede80ecd59f662f536368ce2efe7d26745d
parent b5759618
...@@ -556,6 +556,7 @@ class HandshakeCallback : public AsyncSSLSocket::HandshakeCB { ...@@ -556,6 +556,7 @@ class HandshakeCallback : public AsyncSSLSocket::HandshakeCB {
// Functions inherited from AsyncSSLSocketHandshakeCallback // Functions inherited from AsyncSSLSocketHandshakeCallback
void handshakeSuc(AsyncSSLSocket* sock) noexcept override { void handshakeSuc(AsyncSSLSocket* sock) noexcept override {
isResumed_ = sock->getSSLSessionReused();
std::lock_guard<std::mutex> g(mutex_); std::lock_guard<std::mutex> g(mutex_);
cv_.notify_all(); cv_.notify_all();
EXPECT_EQ(sock, socket_.get()); EXPECT_EQ(sock, socket_.get());
...@@ -567,6 +568,7 @@ class HandshakeCallback : public AsyncSSLSocket::HandshakeCB { ...@@ -567,6 +568,7 @@ class HandshakeCallback : public AsyncSSLSocket::HandshakeCB {
void handshakeErr( void handshakeErr(
AsyncSSLSocket* /* sock */, AsyncSSLSocket* /* sock */,
const AsyncSocketException& ex) noexcept override { const AsyncSocketException& ex) noexcept override {
isResumed_ = false;
std::lock_guard<std::mutex> g(mutex_); std::lock_guard<std::mutex> g(mutex_);
cv_.notify_all(); cv_.notify_all();
std::cerr << "HandshakeCallback::handshakeError " << ex.what() << std::endl; std::cerr << "HandshakeCallback::handshakeError " << ex.what() << std::endl;
...@@ -596,6 +598,10 @@ class HandshakeCallback : public AsyncSSLSocket::HandshakeCB { ...@@ -596,6 +598,10 @@ class HandshakeCallback : public AsyncSSLSocket::HandshakeCB {
return socket_; return socket_;
} }
bool isResumed() const {
return isResumed_;
}
StateEnum state; StateEnum state;
std::shared_ptr<AsyncSSLSocket> socket_; std::shared_ptr<AsyncSSLSocket> socket_;
ReadCallbackBase* rcb_; ReadCallbackBase* rcb_;
...@@ -603,6 +609,7 @@ class HandshakeCallback : public AsyncSSLSocket::HandshakeCB { ...@@ -603,6 +609,7 @@ class HandshakeCallback : public AsyncSSLSocket::HandshakeCB {
std::mutex mutex_; std::mutex mutex_;
std::condition_variable cv_; std::condition_variable cv_;
std::string errorString_; std::string errorString_;
bool isResumed_{false};
}; };
class SSLServerAcceptCallback : public SSLServerAcceptCallbackBase { class SSLServerAcceptCallback : public SSLServerAcceptCallbackBase {
......
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