summaryrefslogtreecommitdiffstats
path: root/net/socket/ssl_client_socket_nss.cc
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-02 23:25:19 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-02 23:25:19 +0000
commit5a05c47ae2a497d4efbbb9166fa5ff7aebfd4ecf (patch)
tree4f39f1f44be3eb179f8368bca0bc18512e398a40 /net/socket/ssl_client_socket_nss.cc
parentf852667f469ea8fd31b8a1dd0f0130382efe591f (diff)
downloadchromium_src-5a05c47ae2a497d4efbbb9166fa5ff7aebfd4ecf.zip
chromium_src-5a05c47ae2a497d4efbbb9166fa5ff7aebfd4ecf.tar.gz
chromium_src-5a05c47ae2a497d4efbbb9166fa5ff7aebfd4ecf.tar.bz2
Add LoadLog to ClientSocket::Connect().
TODO: Use LoadLog in FLIP code. Review URL: http://codereview.chromium.org/344026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30765 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/ssl_client_socket_nss.cc')
-rw-r--r--net/socket/ssl_client_socket_nss.cc39
1 files changed, 30 insertions, 9 deletions
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc
index 72c1bc3..ca523d5 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -69,6 +69,7 @@
#include "base/string_util.h"
#include "net/base/cert_verifier.h"
#include "net/base/io_buffer.h"
+#include "net/base/load_log.h"
#include "net/base/net_errors.h"
#include "net/base/ssl_cert_request_info.h"
#include "net/base/ssl_info.h"
@@ -236,7 +237,8 @@ int SSLClientSocketNSS::Init() {
return OK;
}
-int SSLClientSocketNSS::Connect(CompletionCallback* callback) {
+int SSLClientSocketNSS::Connect(CompletionCallback* callback,
+ LoadLog* load_log) {
EnterFunction("");
DCHECK(transport_.get());
DCHECK(next_handshake_state_ == STATE_NONE);
@@ -246,10 +248,32 @@ int SSLClientSocketNSS::Connect(CompletionCallback* callback) {
DCHECK(!user_read_buf_);
DCHECK(!user_write_buf_);
+ LoadLog::BeginEvent(load_log, LoadLog::TYPE_SSL_CONNECT);
+
if (Init() != OK) {
NOTREACHED() << "Couldn't initialize nss";
}
+ int rv = InitializeSSLOptions();
+ if (rv != OK) {
+ LoadLog::EndEvent(load_log, LoadLog::TYPE_SSL_CONNECT);
+ return rv;
+ }
+
+ GotoState(STATE_HANDSHAKE);
+ rv = DoHandshakeLoop(OK);
+ if (rv == ERR_IO_PENDING) {
+ user_connect_callback_ = callback;
+ load_log_ = load_log;
+ } else {
+ LoadLog::EndEvent(load_log, LoadLog::TYPE_SSL_CONNECT);
+ }
+
+ LeaveFunction("");
+ return rv > OK ? OK : rv;
+}
+
+int SSLClientSocketNSS::InitializeSSLOptions() {
// Transport connected, now hook it up to nss
// TODO(port): specify rx and tx buffer sizes separately
nss_fd_ = memio_CreateIOLayer(kRecvBufferSize);
@@ -337,13 +361,7 @@ int SSLClientSocketNSS::Connect(CompletionCallback* callback) {
// Tell SSL we're a client; needed if not letting NSPR do socket I/O
SSL_ResetHandshake(nss_fd_, 0);
- GotoState(STATE_HANDSHAKE);
- rv = DoHandshakeLoop(OK);
- if (rv == ERR_IO_PENDING)
- user_connect_callback_ = callback;
-
- LeaveFunction("");
- return rv > OK ? OK : rv;
+ return OK;
}
void SSLClientSocketNSS::InvalidateSessionIfBadCertificate() {
@@ -576,8 +594,11 @@ void SSLClientSocketNSS::DoConnectCallback(int rv) {
void SSLClientSocketNSS::OnHandshakeIOComplete(int result) {
EnterFunction(result);
int rv = DoHandshakeLoop(result);
- if (rv != ERR_IO_PENDING)
+ if (rv != ERR_IO_PENDING) {
+ LoadLog::EndEvent(load_log_, net::LoadLog::TYPE_SSL_CONNECT);
+ load_log_ = NULL;
DoConnectCallback(rv);
+ }
LeaveFunction("");
}