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

Side by Side Diff: net/spdy/spdy_proxy_client_socket.cc

Issue 14311002: [SPDY] Avoid leaking bytes from the session flow control receive window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_http_stream.cc ('k') | net/spdy/spdy_session.h » ('j') | 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 #include "net/spdy/spdy_proxy_client_socket.h" 5 #include "net/spdy/spdy_proxy_client_socket.h"
6 6
7 #include <algorithm> // min 7 #include <algorithm> // min
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 user_buffer_len_ = static_cast<size_t>(buf_len); 210 user_buffer_len_ = static_cast<size_t>(buf_len);
211 DCHECK(!callback.is_null()); 211 DCHECK(!callback.is_null());
212 read_callback_ = callback; 212 read_callback_ = callback;
213 return ERR_IO_PENDING; 213 return ERR_IO_PENDING;
214 } 214 }
215 user_buffer_ = NULL; 215 user_buffer_ = NULL;
216 return result; 216 return result;
217 } 217 }
218 218
219 size_t SpdyProxyClientSocket::PopulateUserReadBuffer(char* data, size_t len) { 219 size_t SpdyProxyClientSocket::PopulateUserReadBuffer(char* data, size_t len) {
220 size_t bytes_consumed = read_buffer_queue_.Dequeue(data, len); 220 return read_buffer_queue_.Dequeue(data, len);
221
222 if (bytes_consumed > 0 && spdy_stream_)
223 spdy_stream_->IncreaseRecvWindowSize(bytes_consumed);
224
225 return bytes_consumed;
226 } 221 }
227 222
228 int SpdyProxyClientSocket::Write(IOBuffer* buf, int buf_len, 223 int SpdyProxyClientSocket::Write(IOBuffer* buf, int buf_len,
229 const CompletionCallback& callback) { 224 const CompletionCallback& callback) {
230 DCHECK(write_callback_.is_null()); 225 DCHECK(write_callback_.is_null());
231 if (next_state_ != STATE_OPEN) 226 if (next_state_ != STATE_OPEN)
232 return ERR_SOCKET_NOT_CONNECTED; 227 return ERR_SOCKET_NOT_CONNECTED;
233 228
234 DCHECK(spdy_stream_); 229 DCHECK(spdy_stream_);
235 write_bytes_outstanding_= buf_len; 230 write_bytes_outstanding_= buf_len;
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 } else if (!read_callback_.is_null()) { 573 } else if (!read_callback_.is_null()) {
579 // If we have a read_callback_, the we need to make sure we call it back. 574 // If we have a read_callback_, the we need to make sure we call it back.
580 OnDataReceived(scoped_ptr<SpdyBuffer>()); 575 OnDataReceived(scoped_ptr<SpdyBuffer>());
581 } 576 }
582 // This may have been deleted by read_callback_, so check first. 577 // This may have been deleted by read_callback_, so check first.
583 if (weak_ptr && !write_callback.is_null()) 578 if (weak_ptr && !write_callback.is_null())
584 write_callback.Run(ERR_CONNECTION_CLOSED); 579 write_callback.Run(ERR_CONNECTION_CLOSED);
585 } 580 }
586 581
587 } // namespace net 582 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_http_stream.cc ('k') | net/spdy/spdy_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698