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

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

Issue 11633021: When using NSS, only schedule transport socket reads when the transport buffer is empty. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
« net/base/nss_memio.c ('K') | « net/base/nss_memio.c ('k') | 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 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 } 2094 }
2095 return network_moved; 2095 return network_moved;
2096 } 2096 }
2097 2097
2098 int SSLClientSocketNSS::Core::BufferRecv() { 2098 int SSLClientSocketNSS::Core::BufferRecv() {
2099 DCHECK(OnNSSTaskRunner()); 2099 DCHECK(OnNSSTaskRunner());
2100 2100
2101 if (transport_recv_busy_) 2101 if (transport_recv_busy_)
2102 return ERR_IO_PENDING; 2102 return ERR_IO_PENDING;
2103 2103
2104 // Determine how much was requested from |nss_bufs_| by NSS but that was
2105 // unavailable.
wtc 2012/12/20 02:41:22 This comment is also not very clear. It could be i
Ryan Sleevi 2012/12/20 02:55:58 That is correct, because that is what it does.
2106 int requested = memio_GetReadRequest(nss_bufs_);
2107 if (requested == 0) {
2108 // This is not a perfect match of error codes, as no operation is
2109 // actually pending. However, returning 0 would be interpreted as a
2110 // possible sign of EOF, which is also an inappropriate match.
2111 return ERR_IO_PENDING;
2112 }
2113
2114 // Known Issue: While only reading |requested| bytes is the correct
wtc 2012/12/20 02:41:22 Don't add this comment. This isn't an issue. The c
2115 // implementation, it has the downside of resulting in frequent reads:
2116 // One read for the SSL record header (~5 bytes) and one read for the SSL
2117 // record body. Rather than issuing these small reads to the underlying
2118 // socket (and constantly allocating new IOBuffers), a single Read()
2119 // request to fill |nss_bufs_| is issued. As long as an SSL client socket
2120 // cannot be gracefully shutdown (eg: via SSL close alerts) and then
2121 // re-used for non-SSL traffic, this over-subscribed Read()ing will not
2122 // cause issues.
wtc 2012/12/20 02:41:22 The SSLClientSocketNSS constructor is documented t
2104 char* buf; 2123 char* buf;
2105 int nb = memio_GetReadParams(nss_bufs_, &buf); 2124 int nb = memio_GetReadParams(nss_bufs_, &buf);
2106 int rv; 2125 int rv;
2107 if (!nb) { 2126 if (!nb) {
2108 // buffer too full to read into, so no I/O possible at moment 2127 // buffer too full to read into, so no I/O possible at moment
2109 rv = ERR_IO_PENDING; 2128 rv = ERR_IO_PENDING;
2110 } else { 2129 } else {
2111 scoped_refptr<IOBuffer> read_buffer(new IOBuffer(nb)); 2130 scoped_refptr<IOBuffer> read_buffer(new IOBuffer(nb));
2112 if (OnNetworkTaskRunner()) { 2131 if (OnNetworkTaskRunner()) {
2113 rv = DoBufferRecv(read_buffer, nb); 2132 rv = DoBufferRecv(read_buffer, nb);
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after
3449 EnsureThreadIdAssigned(); 3468 EnsureThreadIdAssigned();
3450 base::AutoLock auto_lock(lock_); 3469 base::AutoLock auto_lock(lock_);
3451 return valid_thread_id_ == base::PlatformThread::CurrentId(); 3470 return valid_thread_id_ == base::PlatformThread::CurrentId();
3452 } 3471 }
3453 3472
3454 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const { 3473 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const {
3455 return server_bound_cert_service_; 3474 return server_bound_cert_service_;
3456 } 3475 }
3457 3476
3458 } // namespace net 3477 } // namespace net
OLDNEW
« net/base/nss_memio.c ('K') | « net/base/nss_memio.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698