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

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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « 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..92f6c37f4ef564aeb959f6e16ef969674a432b63 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -2101,6 +2101,17 @@ int SSLClientSocketNSS::Core::BufferRecv() {
if (transport_recv_busy_)
return ERR_IO_PENDING;
+ // If NSS is blocked on reading from |nss_bufs_|, because it is empty,
+ // determine how much data NSS wants to read. If NSS was not blocked,
+ // this will return 0.
+ 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;
+ }
+
char* buf;
int nb = memio_GetReadParams(nss_bufs_, &buf);
int rv;
« 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