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

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

Issue 9392030: SPDY Proxy - Bug fix to handle flow control (spdy/2.1) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 10 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_stream.cc » ('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) 2011 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"
11 #include "base/logging.h" 11 #include "base/logging.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 return ERR_IO_PENDING; 165 return ERR_IO_PENDING;
166 } 166 }
167 user_buffer_ = NULL; 167 user_buffer_ = NULL;
168 return result; 168 return result;
169 } 169 }
170 170
171 int SpdyProxyClientSocket::PopulateUserReadBuffer() { 171 int SpdyProxyClientSocket::PopulateUserReadBuffer() {
172 if (!user_buffer_) 172 if (!user_buffer_)
173 return ERR_IO_PENDING; 173 return ERR_IO_PENDING;
174 174
175 int bytes_read = 0;
175 while (!read_buffer_.empty() && user_buffer_->BytesRemaining() > 0) { 176 while (!read_buffer_.empty() && user_buffer_->BytesRemaining() > 0) {
176 scoped_refptr<DrainableIOBuffer> data = read_buffer_.front(); 177 scoped_refptr<DrainableIOBuffer> data = read_buffer_.front();
177 const int bytes_to_copy = std::min(user_buffer_->BytesRemaining(), 178 const int bytes_to_copy = std::min(user_buffer_->BytesRemaining(),
178 data->BytesRemaining()); 179 data->BytesRemaining());
179 memcpy(user_buffer_->data(), data->data(), bytes_to_copy); 180 memcpy(user_buffer_->data(), data->data(), bytes_to_copy);
willchan no longer on Chromium 2012/02/14 06:11:48 Don't you need to do bytes_read += bytes_to_copy?
ramant (doing other things) 2012/02/14 06:34:28 I lost that change when I moved my change from one
180 user_buffer_->DidConsume(bytes_to_copy); 181 user_buffer_->DidConsume(bytes_to_copy);
181 if (data->BytesRemaining() == bytes_to_copy) { 182 if (data->BytesRemaining() == bytes_to_copy) {
182 // Consumed all data from this buffer 183 // Consumed all data from this buffer
183 read_buffer_.pop_front(); 184 read_buffer_.pop_front();
184 } else { 185 } else {
185 data->DidConsume(bytes_to_copy); 186 data->DidConsume(bytes_to_copy);
186 } 187 }
187 } 188 }
188 189
190 if (bytes_read > 0) {
191 DCHECK(spdy_stream_);
192 spdy_stream_->IncreaseRecvWindowSize(bytes_read);
193 }
189 return user_buffer_->BytesConsumed(); 194 return user_buffer_->BytesConsumed();
190 } 195 }
191 196
192 int SpdyProxyClientSocket::Write(IOBuffer* buf, int buf_len, 197 int SpdyProxyClientSocket::Write(IOBuffer* buf, int buf_len,
193 const CompletionCallback& callback) { 198 const CompletionCallback& callback) {
194 DCHECK(write_callback_.is_null()); 199 DCHECK(write_callback_.is_null());
195 if (next_state_ != STATE_OPEN) 200 if (next_state_ != STATE_OPEN)
196 return ERR_SOCKET_NOT_CONNECTED; 201 return ERR_SOCKET_NOT_CONNECTED;
197 202
198 DCHECK(spdy_stream_); 203 DCHECK(spdy_stream_);
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 } 512 }
508 // This may have been deleted by read_callback_, so check first. 513 // This may have been deleted by read_callback_, so check first.
509 if (weak_ptr && !write_callback.is_null()) 514 if (weak_ptr && !write_callback.is_null())
510 write_callback.Run(ERR_CONNECTION_CLOSED); 515 write_callback.Run(ERR_CONNECTION_CLOSED);
511 } 516 }
512 517
513 void SpdyProxyClientSocket::set_chunk_callback(ChunkCallback* /*callback*/) { 518 void SpdyProxyClientSocket::set_chunk_callback(ChunkCallback* /*callback*/) {
514 } 519 }
515 520
516 } // namespace net 521 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_http_stream.cc ('k') | net/spdy/spdy_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698