summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjiayl@webrtc.org <jiayl@webrtc.org>2014-09-24 21:13:39 +0000
committerjiayl@webrtc.org <jiayl@webrtc.org>2014-09-24 21:13:39 +0000
commitff353df2f1dea1340d1d0b8819273d95a50186e1 (patch)
tree703f71b4b72ecd794cd6f25739777e1dd8984da5
parent6a4908d7c43142e8f2843669b4d6d709cc61f9b4 (diff)
downloadwebrtc-ff353df2f1dea1340d1d0b8819273d95a50186e1.tar.gz
Call SSL_shutdown in OpenSSLStreamAdapter::Cleanup.
BUG=crbug/414211 R=juberti@webrtc.org Review URL: https://webrtc-codereview.appspot.com/22739004 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@7293 4adac7df-926f-26a2-2b94-8c16560cd09d
-rw-r--r--base/opensslstreamadapter.cc6
-rw-r--r--base/sslstreamadapter_unittest.cc7
2 files changed, 13 insertions, 0 deletions
diff --git a/base/opensslstreamadapter.cc b/base/opensslstreamadapter.cc
index 070a948b..133eb72b 100644
--- a/base/opensslstreamadapter.cc
+++ b/base/opensslstreamadapter.cc
@@ -695,6 +695,12 @@ void OpenSSLStreamAdapter::Cleanup() {
}
if (ssl_) {
+ int ret = SSL_shutdown(ssl_);
+ if (ret < 0) {
+ LOG(LS_WARNING) << "SSL_shutdown failed, error = "
+ << SSL_get_error(ssl_, ret);
+ }
+
SSL_free(ssl_);
ssl_ = NULL;
}
diff --git a/base/sslstreamadapter_unittest.cc b/base/sslstreamadapter_unittest.cc
index f7dcb71e..05383143 100644
--- a/base/sslstreamadapter_unittest.cc
+++ b/base/sslstreamadapter_unittest.cc
@@ -691,6 +691,13 @@ TEST_F(SSLStreamAdapterTestTLS, TestTLSConnect) {
TestHandshake();
};
+// Test that closing the connection on one side updates the other side.
+TEST_F(SSLStreamAdapterTestTLS, TestTLSClose) {
+ TestHandshake();
+ client_ssl_->Close();
+ EXPECT_EQ_WAIT(rtc::SS_CLOSED, server_ssl_->GetState(), handshake_wait_);
+};
+
// Test transfer -- trivial
TEST_F(SSLStreamAdapterTestTLS, TestTLSTransfer) {
TestHandshake();