Remove OpenSSLAdapter restartable_ data member.
Bug: webrtc:10198 Change-Id: I5beabba3837b92d600e2d7067954adf334adbdd0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173335 Reviewed-by: Justin Uberti <juberti@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31056}
This commit is contained in:
parent
8a948a3e2b
commit
2d2c2947fd
@ -157,7 +157,7 @@ AsyncPacketSocket* BasicPacketSocketFactory::CreateClientTcpSocket(
|
||||
|
||||
socket = ssl_adapter;
|
||||
|
||||
if (ssl_adapter->StartSSL(remote_address.hostname().c_str(), false) != 0) {
|
||||
if (ssl_adapter->StartSSL(remote_address.hostname().c_str()) != 0) {
|
||||
delete ssl_adapter;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -177,7 +177,6 @@ OpenSSLAdapter::OpenSSLAdapter(AsyncSocket* socket,
|
||||
role_(SSL_CLIENT),
|
||||
ssl_read_needs_write_(false),
|
||||
ssl_write_needs_read_(false),
|
||||
restartable_(false),
|
||||
ssl_(nullptr),
|
||||
ssl_ctx_(nullptr),
|
||||
ssl_mode_(SSL_MODE_TLS),
|
||||
@ -248,16 +247,15 @@ AsyncSocket* OpenSSLAdapter::Accept(SocketAddress* paddr) {
|
||||
adapter->SetIdentity(identity_->Clone());
|
||||
adapter->SetRole(rtc::SSL_SERVER);
|
||||
adapter->SetIgnoreBadCert(ignore_bad_cert_);
|
||||
adapter->StartSSL("", false);
|
||||
adapter->StartSSL("");
|
||||
return adapter;
|
||||
}
|
||||
|
||||
int OpenSSLAdapter::StartSSL(const char* hostname, bool restartable) {
|
||||
int OpenSSLAdapter::StartSSL(const char* hostname) {
|
||||
if (state_ != SSL_NONE)
|
||||
return -1;
|
||||
|
||||
ssl_host_name_ = hostname;
|
||||
restartable_ = restartable;
|
||||
|
||||
if (socket_->GetState() != Socket::CS_CONNECTED) {
|
||||
state_ = SSL_WAIT;
|
||||
@ -653,7 +651,7 @@ int OpenSSLAdapter::RecvFrom(void* pv,
|
||||
|
||||
int OpenSSLAdapter::Close() {
|
||||
Cleanup();
|
||||
state_ = restartable_ ? SSL_WAIT : SSL_NONE;
|
||||
state_ = SSL_NONE;
|
||||
return AsyncSocketAdapter::Close();
|
||||
}
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ class OpenSSLAdapter final : public SSLAdapter, public MessageHandler {
|
||||
void SetIdentity(std::unique_ptr<SSLIdentity> identity) override;
|
||||
void SetRole(SSLRole role) override;
|
||||
AsyncSocket* Accept(SocketAddress* paddr) override;
|
||||
int StartSSL(const char* hostname, bool restartable) override;
|
||||
int StartSSL(const char* hostname) override;
|
||||
int Send(const void* pv, size_t cb) override;
|
||||
int SendTo(const void* pv, size_t cb, const SocketAddress& addr) override;
|
||||
int Recv(void* pv, size_t cb, int64_t* timestamp) override;
|
||||
@ -128,9 +128,6 @@ class OpenSSLAdapter final : public SSLAdapter, public MessageHandler {
|
||||
SSLRole role_;
|
||||
bool ssl_read_needs_write_;
|
||||
bool ssl_write_needs_read_;
|
||||
// If true, socket will retain SSL configuration after Close.
|
||||
// TODO(juberti): Remove this unused flag.
|
||||
bool restartable_;
|
||||
// This buffer is used if SSL_write fails with SSL_ERROR_WANT_WRITE, which
|
||||
// means we need to keep retrying with *the same exact data* until it
|
||||
// succeeds. Afterwards it will be cleared.
|
||||
|
||||
@ -80,7 +80,7 @@ TEST(OpenSSLAdapterTest, TestTransformAlpnProtocols) {
|
||||
TEST(OpenSSLAdapterTest, TestBeginSSLBeforeConnection) {
|
||||
AsyncSocket* async_socket = new MockAsyncSocket();
|
||||
OpenSSLAdapter adapter(async_socket);
|
||||
EXPECT_EQ(adapter.StartSSL("webrtc.org", false), 0);
|
||||
EXPECT_EQ(adapter.StartSSL("webrtc.org"), 0);
|
||||
}
|
||||
|
||||
// Verifies that the adapter factory can create new adapters.
|
||||
|
||||
@ -79,8 +79,7 @@ class SSLAdapter : public AsyncSocketAdapter {
|
||||
// StartSSL returns 0 if successful.
|
||||
// If StartSSL is called while the socket is closed or connecting, the SSL
|
||||
// negotiation will begin as soon as the socket connects.
|
||||
// TODO(juberti): Remove |restartable|.
|
||||
virtual int StartSSL(const char* hostname, bool restartable = false) = 0;
|
||||
virtual int StartSSL(const char* hostname) = 0;
|
||||
|
||||
// When an SSLAdapterFactory is used, an SSLAdapter may be used to resume
|
||||
// a previous SSL session, which results in an abbreviated handshake.
|
||||
|
||||
@ -111,7 +111,7 @@ class SSLAdapterTestDummyClient : public sigslot::has_slots<> {
|
||||
RTC_LOG(LS_INFO) << "Starting " << GetSSLProtocolName(ssl_mode_)
|
||||
<< " handshake with " << hostname;
|
||||
|
||||
if (ssl_adapter_->StartSSL(hostname.c_str(), false) != 0) {
|
||||
if (ssl_adapter_->StartSSL(hostname.c_str()) != 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user