| 223 | } |
| 224 | |
| 225 | int HttpMessage::UnlockAndFlushToBodyReader(std::unique_lock<butil::Mutex>& mu) { |
| 226 | if (_body.empty()) { |
| 227 | mu.unlock(); |
| 228 | return 0; |
| 229 | } |
| 230 | butil::IOBuf body_seen = _body.movable(); |
| 231 | ProgressiveReader* r = _body_reader; |
| 232 | mu.unlock(); |
| 233 | for (size_t i = 0; i < body_seen.backing_block_num(); ++i) { |
| 234 | butil::StringPiece blk = body_seen.backing_block(i); |
| 235 | butil::Status st = r->OnReadOnePart(blk.data(), blk.size()); |
| 236 | if (!st.ok()) { |
| 237 | mu.lock(); |
| 238 | _body_reader = NULL; |
| 239 | mu.unlock(); |
| 240 | r->OnEndOfMessage(st); |
| 241 | return -1; |
| 242 | } |
| 243 | } |
| 244 | return 0; |
| 245 | } |
| 246 | |
| 247 | int HttpMessage::on_body_cb(http_parser *parser, |
| 248 | const char *at, const size_t length) { |
nothing calls this directly
no test coverage detected