summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-13 02:13:59 +0000
committerwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-13 02:13:59 +0000
commit8a1abafdb14f786caa7fbd3ae8f0aaa9fe12bb6b (patch)
tree1c01d958a30524458fec5a4afa28e650a74c4523 /net
parentdfd3112b6556737ec375ebe0f721fc085788dcd6 (diff)
downloadchromium_src-8a1abafdb14f786caa7fbd3ae8f0aaa9fe12bb6b.zip
chromium_src-8a1abafdb14f786caa7fbd3ae8f0aaa9fe12bb6b.tar.gz
chromium_src-8a1abafdb14f786caa7fbd3ae8f0aaa9fe12bb6b.tar.bz2
The network_moved check in DoHandshakeLoop should only apply to
STATE_HANDSHAKE. After transport I/O completes synchronously, stay in the handshake loop only if the next state is STATE_HANDSHAKE, which is the only state that requires transport I/O to make progress. If the next state is any other state, we should ignore network_moved when determing if we should stay in the handshake loop. This changelist is the synchronous completion version of http://codereview.chromium.org/660131, which dealt with this bug when transport I/O completes asynchronously. R=agl@chromium.org BUG=109706 TEST=Run a Chrome debug build with --enable-origin-bound-certs and connect to a Google server such as gmail over HTTPS. Should not hit a DCHECK failure in net_log.cc. Review URL: http://codereview.chromium.org/9172005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117578 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/socket/ssl_client_socket_nss.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc
index 654b467..50b7514 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -1258,7 +1258,6 @@ void SSLClientSocketNSS::OnRecvComplete(int result) {
int SSLClientSocketNSS::DoHandshakeLoop(int last_io_result) {
EnterFunction(last_io_result);
- bool network_moved;
int rv = last_io_result;
do {
// Default to STATE_NONE for next state.
@@ -1269,10 +1268,8 @@ int SSLClientSocketNSS::DoHandshakeLoop(int last_io_result) {
State state = next_handshake_state_;
GotoState(STATE_NONE);
switch (state) {
- case STATE_NONE:
- // we're just pumping data between the buffer and the network
- break;
case STATE_LOAD_SSL_HOST_INFO:
+ DCHECK(rv == OK || rv == ERR_IO_PENDING);
rv = DoLoadSSLHostInfo();
break;
case STATE_HANDSHAKE:
@@ -1291,6 +1288,7 @@ int SSLClientSocketNSS::DoHandshakeLoop(int last_io_result) {
case STATE_VERIFY_CERT_COMPLETE:
rv = DoVerifyCertComplete(rv);
break;
+ case STATE_NONE:
default:
rv = ERR_UNEXPECTED;
LOG(DFATAL) << "unexpected state " << state;
@@ -1298,9 +1296,15 @@ int SSLClientSocketNSS::DoHandshakeLoop(int last_io_result) {
}
// Do the actual network I/O
- network_moved = DoTransportIO();
- } while ((rv != ERR_IO_PENDING || network_moved) &&
- next_handshake_state_ != STATE_NONE);
+ bool network_moved = DoTransportIO();
+ if (network_moved && next_handshake_state_ == STATE_HANDSHAKE) {
+ // In general we exit the loop if rv is ERR_IO_PENDING. In this
+ // special case we keep looping even if rv is ERR_IO_PENDING because
+ // the transport IO may allow DoHandshake to make progress.
+ DCHECK(rv == OK || rv == ERR_IO_PENDING);
+ rv = OK; // This causes us to stay in the loop.
+ }
+ } while (rv != ERR_IO_PENDING && next_handshake_state_ != STATE_NONE);
LeaveFunction("");
return rv;
}