OLD | NEW |
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/http/http_response_body_drainer.h" | 5 #include "net/http/http_response_body_drainer.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 void HttpResponseBodyDrainer::OnTimerFired() { | 106 void HttpResponseBodyDrainer::OnTimerFired() { |
107 Finish(ERR_TIMED_OUT); | 107 Finish(ERR_TIMED_OUT); |
108 } | 108 } |
109 | 109 |
110 void HttpResponseBodyDrainer::Finish(int result) { | 110 void HttpResponseBodyDrainer::Finish(int result) { |
111 DCHECK_NE(ERR_IO_PENDING, result); | 111 DCHECK_NE(ERR_IO_PENDING, result); |
112 | 112 |
113 if (session_) | 113 if (session_) |
114 session_->RemoveResponseDrainer(this); | 114 session_->RemoveResponseDrainer(this); |
115 | 115 |
116 if (result < 0) { | 116 if (result < 0 || !stream_->CanReuseConnection()) { |
117 stream_->Close(true /* no keep-alive */); | 117 stream_->Close(true /* no keep-alive */); |
118 } else { | 118 } else { |
119 DCHECK_EQ(OK, result); | 119 DCHECK_EQ(OK, result); |
120 stream_->Close(false /* keep-alive */); | 120 stream_->Close(false /* keep-alive */); |
121 } | 121 } |
122 | 122 |
123 delete this; | 123 delete this; |
124 } | 124 } |
125 | 125 |
126 } // namespace net | 126 } // namespace net |
OLD | NEW |