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

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: - 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 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 } 1742 }
1743 1743
1744 void SSLClientSocketNSS::UncorkAfterTimeout() { 1744 void SSLClientSocketNSS::UncorkAfterTimeout() {
1745 corked_ = false; 1745 corked_ = false;
1746 int nsent; 1746 int nsent;
1747 do { 1747 do {
1748 nsent = BufferSend(); 1748 nsent = BufferSend();
1749 } while (nsent > 0); 1749 } while (nsent > 0);
1750 } 1750 }
1751 1751
1752 // Do network I/O between the given buffer and the given socket. 1752 // Do as much network I/O as possible between the buffer and the
1753 // Return true if some I/O performed, false otherwise (error or ERR_IO_PENDING) 1753 // transport socket. Return true if some I/O performed, false
1754 // otherwise (error or ERR_IO_PENDING).
1754 bool SSLClientSocketNSS::DoTransportIO() { 1755 bool SSLClientSocketNSS::DoTransportIO() {
1755 EnterFunction(""); 1756 EnterFunction("");
1756 bool network_moved = false; 1757 bool network_moved = false;
1757 if (nss_bufs_ != NULL) { 1758 if (nss_bufs_ != NULL) {
1758 int nsent = BufferSend(); 1759 int rv;
1759 int nreceived = BufferRecv(); 1760 // Read and write as much data as we can. Loops are neccessary
1760 network_moved = (nsent > 0 || nreceived >= 0); 1761 // because Read() and Write() may return synchronously.
wtc 2011/07/21 01:06:07 This comment should be updated to only describe th
Sergey Ulanov 2011/07/21 01:11:08 Done.
1762 do {
1763 rv = BufferSend();
1764 if (rv > 0)
1765 network_moved = true;
1766 } while (rv > 0);
1767 if (BufferRecv() >= 0)
1768 network_moved = true;
1761 } 1769 }
1762 LeaveFunction(network_moved); 1770 LeaveFunction(network_moved);
1763 return network_moved; 1771 return network_moved;
1764 } 1772 }
1765 1773
1766 // Return 0 for EOF, 1774 // Return 0 for EOF,
1767 // > 0 for bytes transferred immediately, 1775 // > 0 for bytes transferred immediately,
1768 // < 0 for error (or the non-error ERR_IO_PENDING). 1776 // < 0 for error (or the non-error ERR_IO_PENDING).
1769 int SSLClientSocketNSS::BufferSend(void) { 1777 int SSLClientSocketNSS::BufferSend(void) {
1770 if (transport_send_busy_) 1778 if (transport_send_busy_)
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
2281 valid_thread_id_ = base::PlatformThread::CurrentId(); 2289 valid_thread_id_ = base::PlatformThread::CurrentId();
2282 } 2290 }
2283 2291
2284 bool SSLClientSocketNSS::CalledOnValidThread() const { 2292 bool SSLClientSocketNSS::CalledOnValidThread() const {
2285 EnsureThreadIdAssigned(); 2293 EnsureThreadIdAssigned();
2286 base::AutoLock auto_lock(lock_); 2294 base::AutoLock auto_lock(lock_);
2287 return valid_thread_id_ == base::PlatformThread::CurrentId(); 2295 return valid_thread_id_ == base::PlatformThread::CurrentId();
2288 } 2296 }
2289 2297
2290 } // namespace net 2298 } // 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