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

Side by Side Diff: net/socket/ssl_client_socket_nss.cc

Issue 9172005: The network_moved check in DoHandshakeLoop should only apply to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived 5 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived
6 // from AuthCertificateCallback() in 6 // from AuthCertificateCallback() in
7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. 7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp.
8 8
9 /* ***** BEGIN LICENSE BLOCK ***** 9 /* ***** BEGIN LICENSE BLOCK *****
10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 } 1251 }
1252 1252
1253 int rv = DoReadLoop(result); 1253 int rv = DoReadLoop(result);
1254 if (rv != ERR_IO_PENDING) 1254 if (rv != ERR_IO_PENDING)
1255 DoReadCallback(rv); 1255 DoReadCallback(rv);
1256 LeaveFunction(""); 1256 LeaveFunction("");
1257 } 1257 }
1258 1258
1259 int SSLClientSocketNSS::DoHandshakeLoop(int last_io_result) { 1259 int SSLClientSocketNSS::DoHandshakeLoop(int last_io_result) {
1260 EnterFunction(last_io_result); 1260 EnterFunction(last_io_result);
1261 bool network_moved;
1262 int rv = last_io_result; 1261 int rv = last_io_result;
1263 do { 1262 do {
1264 // Default to STATE_NONE for next state. 1263 // Default to STATE_NONE for next state.
1265 // (This is a quirk carried over from the windows 1264 // (This is a quirk carried over from the windows
1266 // implementation. It makes reading the logs a bit harder.) 1265 // implementation. It makes reading the logs a bit harder.)
1267 // State handlers can and often do call GotoState just 1266 // State handlers can and often do call GotoState just
1268 // to stay in the current state. 1267 // to stay in the current state.
1269 State state = next_handshake_state_; 1268 State state = next_handshake_state_;
1270 GotoState(STATE_NONE); 1269 GotoState(STATE_NONE);
1271 switch (state) { 1270 switch (state) {
1272 case STATE_NONE:
1273 // we're just pumping data between the buffer and the network
1274 break;
1275 case STATE_LOAD_SSL_HOST_INFO: 1271 case STATE_LOAD_SSL_HOST_INFO:
1272 DCHECK(rv == OK || rv == ERR_IO_PENDING);
1276 rv = DoLoadSSLHostInfo(); 1273 rv = DoLoadSSLHostInfo();
1277 break; 1274 break;
1278 case STATE_HANDSHAKE: 1275 case STATE_HANDSHAKE:
1279 rv = DoHandshake(); 1276 rv = DoHandshake();
1280 break; 1277 break;
1281 case STATE_GET_OB_CERT_COMPLETE: 1278 case STATE_GET_OB_CERT_COMPLETE:
1282 rv = DoGetOBCertComplete(rv); 1279 rv = DoGetOBCertComplete(rv);
1283 break; 1280 break;
1284 case STATE_VERIFY_DNSSEC: 1281 case STATE_VERIFY_DNSSEC:
1285 rv = DoVerifyDNSSEC(rv); 1282 rv = DoVerifyDNSSEC(rv);
1286 break; 1283 break;
1287 case STATE_VERIFY_CERT: 1284 case STATE_VERIFY_CERT:
1288 DCHECK(rv == OK); 1285 DCHECK(rv == OK);
1289 rv = DoVerifyCert(rv); 1286 rv = DoVerifyCert(rv);
1290 break; 1287 break;
1291 case STATE_VERIFY_CERT_COMPLETE: 1288 case STATE_VERIFY_CERT_COMPLETE:
1292 rv = DoVerifyCertComplete(rv); 1289 rv = DoVerifyCertComplete(rv);
1293 break; 1290 break;
1291 case STATE_NONE:
1294 default: 1292 default:
1295 rv = ERR_UNEXPECTED; 1293 rv = ERR_UNEXPECTED;
1296 LOG(DFATAL) << "unexpected state " << state; 1294 LOG(DFATAL) << "unexpected state " << state;
1297 break; 1295 break;
1298 } 1296 }
1299 1297
1300 // Do the actual network I/O 1298 // Do the actual network I/O
1301 network_moved = DoTransportIO(); 1299 bool network_moved = DoTransportIO();
1302 } while ((rv != ERR_IO_PENDING || network_moved) && 1300 if (network_moved && next_handshake_state_ == STATE_HANDSHAKE) {
1303 next_handshake_state_ != STATE_NONE); 1301 // In general we exit the loop if rv is ERR_IO_PENDING. In this
1302 // special case we continue even if rv is ERR_IO_PENDING because
1303 // the transport IO may allow DoHandshake to make progress.
1304 continue;
wtc 2012/01/11 04:19:55 After a lot of debugging, I finally figured out wh
1305 }
1306 } while (rv != ERR_IO_PENDING && next_handshake_state_ != STATE_NONE);
1304 LeaveFunction(""); 1307 LeaveFunction("");
1305 return rv; 1308 return rv;
1306 } 1309 }
1307 1310
1308 int SSLClientSocketNSS::DoReadLoop(int result) { 1311 int SSLClientSocketNSS::DoReadLoop(int result) {
1309 EnterFunction(""); 1312 EnterFunction("");
1310 DCHECK(completed_handshake_); 1313 DCHECK(completed_handshake_);
1311 DCHECK(next_handshake_state_ == STATE_NONE); 1314 DCHECK(next_handshake_state_ == STATE_NONE);
1312 1315
1313 if (result < 0) 1316 if (result < 0)
(...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after
2710 valid_thread_id_ = base::PlatformThread::CurrentId(); 2713 valid_thread_id_ = base::PlatformThread::CurrentId();
2711 } 2714 }
2712 2715
2713 bool SSLClientSocketNSS::CalledOnValidThread() const { 2716 bool SSLClientSocketNSS::CalledOnValidThread() const {
2714 EnsureThreadIdAssigned(); 2717 EnsureThreadIdAssigned();
2715 base::AutoLock auto_lock(lock_); 2718 base::AutoLock auto_lock(lock_);
2716 return valid_thread_id_ == base::PlatformThread::CurrentId(); 2719 return valid_thread_id_ == base::PlatformThread::CurrentId();
2717 } 2720 }
2718 2721
2719 } // namespace net 2722 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698