diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-23 23:05:09 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-23 23:05:09 +0000 |
commit | 8048a15e53387dd181a9b0dd4548b042320e01d0 (patch) | |
tree | 9d5ee2b2f2d8baaff60afc1fa52f8915b7a2b659 /net/flip/flip_session.cc | |
parent | 4693522c1de4eac9e9b2991402325fef54b5381b (diff) | |
download | chromium_src-8048a15e53387dd181a9b0dd4548b042320e01d0.zip chromium_src-8048a15e53387dd181a9b0dd4548b042320e01d0.tar.gz chromium_src-8048a15e53387dd181a9b0dd4548b042320e01d0.tar.bz2 |
Flip: Fix cancellation code path.
The current fix is suboptimal, since we're doing unnecessary work in the FlipStream (still handling reads and writes for a cancelled stream), but just don't ever hand the data over to a user since they've already cancelled the stream. We should fix this, but don't bother for now. Not calling any user_callback_ is good enough for now.
Review URL: http://codereview.chromium.org/439002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32881 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/flip/flip_session.cc')
-rw-r--r-- | net/flip/flip_session.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/net/flip/flip_session.cc b/net/flip/flip_session.cc index cede942..d3bcedc 100644 --- a/net/flip/flip_session.cc +++ b/net/flip/flip_session.cc @@ -461,15 +461,15 @@ void FlipSession::OnWriteComplete(int result) { scoped_refptr<FlipStream> stream = in_flight_write_.stream(); DCHECK(stream.get()); - if (!stream->cancelled()) { - // Report the number of bytes written to the caller, but exclude the - // frame size overhead. - if (result > 0) { - DCHECK(result > static_cast<int>(flip::FlipFrame::size())); - result -= static_cast<int>(flip::FlipFrame::size()); - } - stream->OnWriteComplete(result); + // Report the number of bytes written to the caller, but exclude the + // frame size overhead. + if (result > 0) { + // TODO(willchan): This is an unsafe DCHECK. I'm hitting this. We should + // handle small writes appropriately. + DCHECK(result > static_cast<int>(flip::FlipFrame::size())); + result -= static_cast<int>(flip::FlipFrame::size()); } + stream->OnWriteComplete(result); // Cleanup the write which just completed. in_flight_write_.release(); |