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

Unified Diff: net/socket/ssl_client_socket_openssl.cc

Issue 10391174: Port two SSLClientSocketNSS fixes to SSLClientSocketOpenSSL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/ssl_client_socket_openssl.h ('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_openssl.cc
===================================================================
--- net/socket/ssl_client_socket_openssl.cc (revision 137510)
+++ net/socket/ssl_client_socket_openssl.cc (working copy)
@@ -416,6 +416,7 @@
const SSLClientSocketContext& context)
: transport_send_busy_(false),
transport_recv_busy_(false),
+ transport_recv_eof_(false),
completed_handshake_(false),
client_auth_cert_needed_(false),
cert_verifier_(context.cert_verifier),
@@ -718,6 +719,7 @@
transport_send_busy_ = false;
send_buffer_ = NULL;
transport_recv_busy_ = false;
+ transport_recv_eof_ = false;
recv_buffer_ = NULL;
user_connect_callback_.Reset();
@@ -955,9 +957,16 @@
bool SSLClientSocketOpenSSL::DoTransportIO() {
bool network_moved = false;
- int nsent = BufferSend();
- int nreceived = BufferRecv();
- network_moved = (nsent > 0 || nreceived >= 0);
+ int rv;
+ // Read and write as much data as we can. The loop is neccessary
+ // because Write() may return synchronously.
+ do {
+ rv = BufferSend();
+ if (rv > 0)
+ network_moved = true;
+ } while (rv > 0);
Johnny(Jianning) Ding 2012/05/18 15:45:58 I don't think it's necessary to use the loop to ke
joth 2012/05/18 16:02:08 wtc will have a better understanding, but I believ
wtc 2012/05/18 18:38:00 jnd: you are right! I did a naive port of the SSL
+ if (!transport_recv_eof_ && BufferRecv() >= 0)
+ network_moved = true;
return network_moved;
}
@@ -1050,6 +1059,8 @@
// Received 0 (end of file) or an error. Either way, bubble it up to the
// SSL layer via the BIO. TODO(joth): consider stashing the error code, to
// relay up to the SSL socket client (i.e. via DoReadCallback).
+ if (result == 0)
+ transport_recv_eof_ = true;
BIO_set_mem_eof_return(transport_bio_, 0);
(void)BIO_shutdown_wr(transport_bio_);
} else {
@@ -1098,6 +1109,7 @@
network_moved = DoTransportIO();
} while (rv_read == ERR_IO_PENDING &&
rv_write == ERR_IO_PENDING &&
+ (user_read_buf_ || user_write_buf_) &&
network_moved);
if (user_read_buf_ && rv_read != ERR_IO_PENDING)
« no previous file with comments | « net/socket/ssl_client_socket_openssl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698