diff options
author | vandebo@google.com <vandebo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-12 00:06:54 +0000 |
---|---|---|
committer | vandebo@google.com <vandebo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-12 00:06:54 +0000 |
commit | 9a1cd5f0fd0c97db72a702e7323b6e0080b823f8 (patch) | |
tree | 248f10063e6a59a4bb22d8963b5c5d588eafd4e4 /net | |
parent | 5a9bb950970d732b3d9f0ed4ecc052c6d213bde4 (diff) | |
download | chromium_src-9a1cd5f0fd0c97db72a702e7323b6e0080b823f8.zip chromium_src-9a1cd5f0fd0c97db72a702e7323b6e0080b823f8.tar.gz chromium_src-9a1cd5f0fd0c97db72a702e7323b6e0080b823f8.tar.bz2 |
More checks to try to find bug 27870.
BUG=27870
TEST=none
Review URL: http://codereview.chromium.org/604022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38857 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/http/http_stream_parser.cc | 7 | ||||
-rw-r--r-- | net/http/http_stream_parser.h | 3 | ||||
-rw-r--r-- | net/socket/tcp_client_socket_win.cc | 10 |
3 files changed, 18 insertions, 2 deletions
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc index 9ec0ad6..eafa90b 100644 --- a/net/http/http_stream_parser.cc +++ b/net/http/http_stream_parser.cc @@ -20,6 +20,7 @@ HttpStreamParser::HttpStreamParser(ClientSocketHandle* connection, request_(NULL), request_headers_(NULL), request_body_(NULL), + expected_request_body_result_(0), read_buf_(read_buffer), read_buf_unused_offset_(0), response_header_start_offset_(-1), @@ -207,11 +208,15 @@ int HttpStreamParser::DoSendHeaders(int result) { } int HttpStreamParser::DoSendBody(int result) { - if (result > 0) + if (result > 0) { + CHECK(result <= expected_request_body_result_) << + expected_request_body_result_; request_body_->DidConsume(result); + } if (!request_body_->eof()) { int buf_len = static_cast<int>(request_body_->buf_len()); + expected_request_body_result_ = buf_len; result = connection_->socket()->Write(request_body_->buf(), buf_len, &io_callback_); } else { diff --git a/net/http/http_stream_parser.h b/net/http/http_stream_parser.h index c47d09e..fb8c393 100644 --- a/net/http/http_stream_parser.h +++ b/net/http/http_stream_parser.h @@ -120,6 +120,9 @@ class HttpStreamParser { // The request body data. scoped_ptr<UploadDataStream> request_body_; + // TODO(vandebo) expected_result is only for debugging. Bug 27870 + int expected_request_body_result_; + // Temporary buffer for reading. scoped_refptr<GrowableIOBuffer> read_buf_; diff --git a/net/socket/tcp_client_socket_win.cc b/net/socket/tcp_client_socket_win.cc index 3046659..32c7725 100644 --- a/net/socket/tcp_client_socket_win.cc +++ b/net/socket/tcp_client_socket_win.cc @@ -146,6 +146,8 @@ class TCPClientSocketWin::Core : public base::RefCounted<Core> { WSABUF write_buffer_; scoped_refptr<IOBuffer> read_iobuffer_; scoped_refptr<IOBuffer> write_iobuffer_; + // TODO(vandebo) remove when bug 27870 is resolved. + size_t write_buffer_length_; // Throttle the read size based on our current slow start state. // Returns the throttled read size. @@ -490,7 +492,8 @@ int TCPClientSocketWin::Write(IOBuffer* buf, DCHECK_NE(socket_, INVALID_SOCKET); DCHECK(!waiting_write_); DCHECK(!write_callback_); - DCHECK_GT(buf_len, 0); + //TODO(vandebo) change back to a DCHECK when 27870 is resolved + CHECK(buf_len > 0); DCHECK(!core_->write_iobuffer_); static StatsCounter reads("tcp.writes"); @@ -498,6 +501,7 @@ int TCPClientSocketWin::Write(IOBuffer* buf, core_->write_buffer_.len = buf_len; core_->write_buffer_.buf = buf->data(); + core_->write_buffer_length_ = static_cast<size_t>(buf_len); TRACE_EVENT_BEGIN("socket.write", this, ""); // TODO(wtc): Remove the CHECK after enough testing. @@ -688,6 +692,10 @@ void TCPClientSocketWin::DidCompleteWrite() { WSAResetEvent(core_->write_overlapped_.hEvent); TRACE_EVENT_END("socket.write", this, StringPrintf("%d bytes", num_bytes)); waiting_write_ = false; + if (ok) { + CHECK(num_bytes <= core_->write_buffer_length_) << + core_->write_buffer_length_; + } core_->write_iobuffer_ = NULL; DoWriteCallback(ok ? num_bytes : MapWinsockError(WSAGetLastError())); } |