From a482bb0d7f453573dff897a4db0ad7e21e6d2e16 Mon Sep 17 00:00:00 2001 From: "avi@chromium.org" Date: Wed, 29 Jul 2009 19:57:46 +0000 Subject: If a write is pending, just add it to the buffer. Don't trigger a second concurrent write. BUG=http://crbug.com/17991 TEST=as in bug Review URL: http://codereview.chromium.org/160333 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21981 0039d316-1c4b-4281-b951-d872f2087c98 --- net/socket/ssl_client_socket_mac.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'net/socket') diff --git a/net/socket/ssl_client_socket_mac.cc b/net/socket/ssl_client_socket_mac.cc index db42c1a..6061dde 100644 --- a/net/socket/ssl_client_socket_mac.cc +++ b/net/socket/ssl_client_socket_mac.cc @@ -736,10 +736,21 @@ OSStatus SSLClientSocketMac::SSLWriteCallback(SSLConnectionRef connection, return status; } + bool send_pending = !us->send_buffer_.empty(); + if (data) us->send_buffer_.insert(us->send_buffer_.end(), static_cast(data), static_cast(data) + *data_length); + + if (send_pending) { + // If we have I/O in flight, just add the data to the end of the buffer and + // return to our caller. The existing callback will trigger the write of the + // new data when it sees that data remains in the buffer after removing the + // sent data. As always, lie to our caller. + return noErr; + } + int rv; do { scoped_refptr buffer = new IOBuffer(us->send_buffer_.size()); -- cgit v1.1