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

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: Review feedback 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
« no previous file with comments | « 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 // If NSS is blocked on reading from |nss_bufs_|, because it is empty,
2105 // determine how much data NSS wants to read. If NSS was not blocked,
2106 // this will return 0.
2107 int requested = memio_GetReadRequest(nss_bufs_);
2108 if (requested == 0) {
2109 // This is not a perfect match of error codes, as no operation is
2110 // actually pending. However, returning 0 would be interpreted as a
2111 // possible sign of EOF, which is also an inappropriate match.
2112 return ERR_IO_PENDING;
2113 }
2114
2104 char* buf; 2115 char* buf;
2105 int nb = memio_GetReadParams(nss_bufs_, &buf); 2116 int nb = memio_GetReadParams(nss_bufs_, &buf);
2106 int rv; 2117 int rv;
2107 if (!nb) { 2118 if (!nb) {
2108 // buffer too full to read into, so no I/O possible at moment 2119 // buffer too full to read into, so no I/O possible at moment
2109 rv = ERR_IO_PENDING; 2120 rv = ERR_IO_PENDING;
2110 } else { 2121 } else {
2111 scoped_refptr<IOBuffer> read_buffer(new IOBuffer(nb)); 2122 scoped_refptr<IOBuffer> read_buffer(new IOBuffer(nb));
2112 if (OnNetworkTaskRunner()) { 2123 if (OnNetworkTaskRunner()) {
2113 rv = DoBufferRecv(read_buffer, nb); 2124 rv = DoBufferRecv(read_buffer, nb);
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after
3449 EnsureThreadIdAssigned(); 3460 EnsureThreadIdAssigned();
3450 base::AutoLock auto_lock(lock_); 3461 base::AutoLock auto_lock(lock_);
3451 return valid_thread_id_ == base::PlatformThread::CurrentId(); 3462 return valid_thread_id_ == base::PlatformThread::CurrentId();
3452 } 3463 }
3453 3464
3454 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const { 3465 ServerBoundCertService* SSLClientSocketNSS::GetServerBoundCertService() const {
3455 return server_bound_cert_service_; 3466 return server_bound_cert_service_;
3456 } 3467 }
3457 3468
3458 } // namespace net 3469 } // namespace net
OLDNEW
« no previous file with comments | « net/base/nss_memio.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698