| Index: net/socket/ssl_client_socket_nss.cc
|
| ===================================================================
|
| --- net/socket/ssl_client_socket_nss.cc (revision 116742)
|
| +++ net/socket/ssl_client_socket_nss.cc (working copy)
|
| @@ -1258,7 +1258,6 @@
|
|
|
| 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 @@
|
| 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 @@
|
| 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 @@
|
| }
|
|
|
| // 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;
|
| }
|
|
|