Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1481)

Unified Diff: net/socket/ssl_client_socket_mac.cc

Issue 2870030: Implement SSLClientSocketPool. (Closed)
Patch Set: Rebase and fix mac compile error Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/socket/ssl_client_socket_mac.cc
diff --git a/net/socket/ssl_client_socket_mac.cc b/net/socket/ssl_client_socket_mac.cc
index f1d2278832aee55850a85060ca87f13a4ef8540c..a19c1b6f3ee5a980609605475444296bb7e6f71d 100644
--- a/net/socket/ssl_client_socket_mac.cc
+++ b/net/socket/ssl_client_socket_mac.cc
@@ -19,6 +19,7 @@
#include "net/base/net_log.h"
#include "net/base/ssl_cert_request_info.h"
#include "net/base/ssl_info.h"
+#include "net/socket/client_socket_handle.h"
// Welcome to Mac SSL. We've been waiting for you.
//
@@ -496,7 +497,7 @@ EnabledCipherSuites::EnabledCipherSuites() {
//-----------------------------------------------------------------------------
-SSLClientSocketMac::SSLClientSocketMac(ClientSocket* transport_socket,
+SSLClientSocketMac::SSLClientSocketMac(ClientSocketHandle* transport_socket,
const std::string& hostname,
const SSLConfig& ssl_config)
: handshake_io_callback_(this, &SSLClientSocketMac::OnHandshakeIOComplete),
@@ -518,7 +519,7 @@ SSLClientSocketMac::SSLClientSocketMac(ClientSocket* transport_socket,
client_cert_requested_(false),
ssl_context_(NULL),
pending_send_error_(OK),
- net_log_(transport_socket->NetLog()) {
+ net_log_(transport_socket->socket()->NetLog()) {
}
SSLClientSocketMac::~SSLClientSocketMac() {
@@ -560,7 +561,7 @@ void SSLClientSocketMac::Disconnect() {
// Shut down anything that may call us back.
verifier_.reset();
- transport_->Disconnect();
+ transport_->socket()->Disconnect();
}
bool SSLClientSocketMac::IsConnected() const {
@@ -570,7 +571,7 @@ bool SSLClientSocketMac::IsConnected() const {
// layer (HttpNetworkTransaction) needs to handle a persistent connection
// closed by the server when we send a request anyway, a false positive in
// exchange for simpler code is a good trade-off.
- return completed_handshake_ && transport_->IsConnected();
+ return completed_handshake_ && transport_->socket()->IsConnected();
}
bool SSLClientSocketMac::IsConnectedAndIdle() const {
@@ -579,13 +580,14 @@ bool SSLClientSocketMac::IsConnectedAndIdle() const {
// Strictly speaking, we should check if we have received the close_notify
// alert message from the server, and return false in that case. Although
// the close_notify alert message means EOF in the SSL layer, it is just
- // bytes to the transport layer below, so transport_->IsConnectedAndIdle()
- // returns the desired false when we receive close_notify.
- return completed_handshake_ && transport_->IsConnectedAndIdle();
+ // bytes to the transport layer below, so
+ // transport_->socket()->IsConnectedAndIdle() returns the desired false
+ // when we receive close_notify.
+ return completed_handshake_ && transport_->socket()->IsConnectedAndIdle();
}
int SSLClientSocketMac::GetPeerAddress(AddressList* address) const {
- return transport_->GetPeerAddress(address);
+ return transport_->socket()->GetPeerAddress(address);
}
int SSLClientSocketMac::Read(IOBuffer* buf, int buf_len,
@@ -627,11 +629,11 @@ int SSLClientSocketMac::Write(IOBuffer* buf, int buf_len,
}
bool SSLClientSocketMac::SetReceiveBufferSize(int32 size) {
- return transport_->SetReceiveBufferSize(size);
+ return transport_->socket()->SetReceiveBufferSize(size);
}
bool SSLClientSocketMac::SetSendBufferSize(int32 size) {
- return transport_->SetSendBufferSize(size);
+ return transport_->socket()->SetSendBufferSize(size);
}
void SSLClientSocketMac::GetSSLInfo(SSLInfo* ssl_info) {
@@ -805,7 +807,7 @@ int SSLClientSocketMac::InitializeSSLContext() {
// different peers, which puts us through certificate validation again
// and catches hostname/certificate name mismatches.
AddressList address;
- int rv = transport_->GetPeerAddress(&address);
+ int rv = transport_->socket()->GetPeerAddress(&address);
if (rv != OK)
return rv;
const struct addrinfo* ai = address.head();
@@ -1217,9 +1219,9 @@ OSStatus SSLClientSocketMac::SSLReadCallback(SSLConnectionRef connection,
int rv = 1; // any old value to spin the loop below
while (rv > 0 && total_read < *data_length) {
us->read_io_buf_ = new IOBuffer(*data_length - total_read);
- rv = us->transport_->Read(us->read_io_buf_,
- *data_length - total_read,
- &us->transport_read_callback_);
+ rv = us->transport_->socket()->Read(us->read_io_buf_,
+ *data_length - total_read,
+ &us->transport_read_callback_);
if (rv >= 0) {
us->recv_buffer_.insert(us->recv_buffer_.end(),
@@ -1279,9 +1281,9 @@ OSStatus SSLClientSocketMac::SSLWriteCallback(SSLConnectionRef connection,
us->write_io_buf_ = new IOBuffer(us->send_buffer_.size());
memcpy(us->write_io_buf_->data(), &us->send_buffer_[0],
us->send_buffer_.size());
- rv = us->transport_->Write(us->write_io_buf_,
- us->send_buffer_.size(),
- &us->transport_write_callback_);
+ rv = us->transport_->socket()->Write(us->write_io_buf_,
+ us->send_buffer_.size(),
+ &us->transport_write_callback_);
if (rv > 0) {
us->send_buffer_.erase(us->send_buffer_.begin(),
us->send_buffer_.begin() + rv);

Powered by Google App Engine
This is Rietveld 408576698