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

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

Issue 7399025: Fix instability in SSL client/server sockets (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simpler fix Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/socket/ssl_server_socket_nss.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 1728
1729 void SSLClientSocketNSS::UncorkAfterTimeout() { 1729 void SSLClientSocketNSS::UncorkAfterTimeout() {
1730 corked_ = false; 1730 corked_ = false;
1731 int nsent; 1731 int nsent;
1732 do { 1732 do {
1733 nsent = BufferSend(); 1733 nsent = BufferSend();
1734 } while (nsent > 0); 1734 } while (nsent > 0);
1735 } 1735 }
1736 1736
1737 // Do network I/O between the given buffer and the given socket. 1737 // Do network I/O between the given buffer and the given socket.
1738 // Return true if some I/O performed, false otherwise (error or ERR_IO_PENDING) 1738 // Return true if some I/O performed, false otherwise (error or ERR_IO_PENDING)
Wez 2011/07/19 20:32:18 nit: Update this comment to indicate that true is
Sergey Ulanov 2011/07/19 21:10:10 Updated the comment. I didn't changed meaning of t
1739 bool SSLClientSocketNSS::DoTransportIO() { 1739 bool SSLClientSocketNSS::DoTransportIO() {
1740 EnterFunction(""); 1740 EnterFunction("");
1741 bool network_moved = false; 1741 bool network_moved = false;
1742 if (nss_bufs_ != NULL) { 1742 if (nss_bufs_ != NULL) {
Wez 2011/07/19 20:33:07 nit: Actually, a comment here to explain the need
Sergey Ulanov 2011/07/19 21:10:10 Done.
1743 int nsent = BufferSend(); 1743 int rv;
1744 int nreceived = BufferRecv(); 1744 do {
1745 network_moved = (nsent > 0 || nreceived >= 0); 1745 rv = BufferSend();
1746 if (rv > 0)
1747 network_moved = true;
1748 } while (rv > 0);
1749 do {
1750 rv = BufferRecv();
1751 if (rv >= 0)
1752 network_moved = true;
1753 } while (rv > 0);
1746 } 1754 }
1747 LeaveFunction(network_moved); 1755 LeaveFunction(network_moved);
1748 return network_moved; 1756 return network_moved;
1749 } 1757 }
1750 1758
1751 // Return 0 for EOF, 1759 // Return 0 for EOF,
1752 // > 0 for bytes transferred immediately, 1760 // > 0 for bytes transferred immediately,
1753 // < 0 for error (or the non-error ERR_IO_PENDING). 1761 // < 0 for error (or the non-error ERR_IO_PENDING).
1754 int SSLClientSocketNSS::BufferSend(void) { 1762 int SSLClientSocketNSS::BufferSend(void) {
1755 if (transport_send_busy_) 1763 if (transport_send_busy_)
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
2269 valid_thread_id_ = base::PlatformThread::CurrentId(); 2277 valid_thread_id_ = base::PlatformThread::CurrentId();
2270 } 2278 }
2271 2279
2272 bool SSLClientSocketNSS::CalledOnValidThread() const { 2280 bool SSLClientSocketNSS::CalledOnValidThread() const {
2273 EnsureThreadIdAssigned(); 2281 EnsureThreadIdAssigned();
2274 base::AutoLock auto_lock(lock_); 2282 base::AutoLock auto_lock(lock_);
2275 return valid_thread_id_ == base::PlatformThread::CurrentId(); 2283 return valid_thread_id_ == base::PlatformThread::CurrentId();
2276 } 2284 }
2277 2285
2278 } // namespace net 2286 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/socket/ssl_server_socket_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698