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

Unified 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 side-by-side diff with in-line comments
Download patch
« net/base/nss_memio.c ('K') | « net/base/nss_memio.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/ssl_client_socket_nss.cc
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc
index f75b5f81d44a23a669d1cc27a7d8f80274dedc68..6858a964bfa428db73edc00e7b2ee36699aeda75 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -2101,6 +2101,25 @@ int SSLClientSocketNSS::Core::BufferRecv() {
if (transport_recv_busy_)
return ERR_IO_PENDING;
+ // Determine how much was requested from |nss_bufs_| by NSS but that was
+ // 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.
+ int requested = memio_GetReadRequest(nss_bufs_);
+ if (requested == 0) {
+ // This is not a perfect match of error codes, as no operation is
+ // actually pending. However, returning 0 would be interpreted as a
+ // possible sign of EOF, which is also an inappropriate match.
+ return ERR_IO_PENDING;
+ }
+
+ // 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
+ // implementation, it has the downside of resulting in frequent reads:
+ // One read for the SSL record header (~5 bytes) and one read for the SSL
+ // record body. Rather than issuing these small reads to the underlying
+ // socket (and constantly allocating new IOBuffers), a single Read()
+ // request to fill |nss_bufs_| is issued. As long as an SSL client socket
+ // cannot be gracefully shutdown (eg: via SSL close alerts) and then
+ // re-used for non-SSL traffic, this over-subscribed Read()ing will not
+ // cause issues.
wtc 2012/12/20 02:41:22 The SSLClientSocketNSS constructor is documented t
char* buf;
int nb = memio_GetReadParams(nss_bufs_, &buf);
int rv;
« 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