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

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: Update FakeSocketTest. 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') | net/socket/ssl_server_socket_nss.cc » ('J')
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 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after
1727 } 1727 }
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 as much as possible network I/O between the buffer and the
1738 // Return true if some I/O performed, false otherwise (error or ERR_IO_PENDING) 1738 // transport socket. Return true if some I/O performed, false
1739 // otherwise (error or ERR_IO_PENDING).
1739 bool SSLClientSocketNSS::DoTransportIO() { 1740 bool SSLClientSocketNSS::DoTransportIO() {
1740 EnterFunction(""); 1741 EnterFunction("");
1741 bool network_moved = false; 1742 bool network_moved = false;
1742 if (nss_bufs_ != NULL) { 1743 if (nss_bufs_ != NULL) {
1743 int nsent = BufferSend(); 1744 int rv;
1744 int nreceived = BufferRecv(); 1745 // Read and write as much data as we can. Loops are neccessary
1745 network_moved = (nsent > 0 || nreceived >= 0); 1746 // because Read() and Write() may return synchronously.
1747 do {
1748 rv = BufferSend();
1749 if (rv > 0)
1750 network_moved = true;
1751 } while (rv > 0);
1752 do {
1753 rv = BufferRecv();
1754 if (rv >= 0)
1755 network_moved = true;
1756 } while (rv > 0);
1746 } 1757 }
1747 LeaveFunction(network_moved); 1758 LeaveFunction(network_moved);
1748 return network_moved; 1759 return network_moved;
1749 } 1760 }
1750 1761
1751 // Return 0 for EOF, 1762 // Return 0 for EOF,
1752 // > 0 for bytes transferred immediately, 1763 // > 0 for bytes transferred immediately,
1753 // < 0 for error (or the non-error ERR_IO_PENDING). 1764 // < 0 for error (or the non-error ERR_IO_PENDING).
1754 int SSLClientSocketNSS::BufferSend(void) { 1765 int SSLClientSocketNSS::BufferSend(void) {
1755 if (transport_send_busy_) 1766 if (transport_send_busy_)
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
2269 valid_thread_id_ = base::PlatformThread::CurrentId(); 2280 valid_thread_id_ = base::PlatformThread::CurrentId();
2270 } 2281 }
2271 2282
2272 bool SSLClientSocketNSS::CalledOnValidThread() const { 2283 bool SSLClientSocketNSS::CalledOnValidThread() const {
2273 EnsureThreadIdAssigned(); 2284 EnsureThreadIdAssigned();
2274 base::AutoLock auto_lock(lock_); 2285 base::AutoLock auto_lock(lock_);
2275 return valid_thread_id_ == base::PlatformThread::CurrentId(); 2286 return valid_thread_id_ == base::PlatformThread::CurrentId();
2276 } 2287 }
2277 2288
2278 } // namespace net 2289 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/socket/ssl_server_socket_nss.cc » ('j') | net/socket/ssl_server_socket_nss.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698