| 1546 | } |
| 1547 | |
| 1548 | void Controller::ReadProgressiveAttachmentBy(ProgressiveReader* r) { |
| 1549 | if (r == NULL) { |
| 1550 | LOG(FATAL) << "Param[r] is NULL"; |
| 1551 | return; |
| 1552 | } |
| 1553 | if (!is_response_read_progressively()) { |
| 1554 | return r->OnEndOfMessage( |
| 1555 | butil::Status(EINVAL, "Can't read progressive attachment from a " |
| 1556 | "controller without calling " |
| 1557 | "response_will_be_read_progressively() before")); |
| 1558 | } |
| 1559 | if (_rpa == NULL) { |
| 1560 | return r->OnEndOfMessage( |
| 1561 | butil::Status(EINVAL, "ReadableProgressiveAttachment is NULL")); |
| 1562 | } |
| 1563 | if (has_progressive_reader()) { |
| 1564 | return r->OnEndOfMessage( |
| 1565 | butil::Status(EPERM, "%s can't be called more than once", |
| 1566 | __FUNCTION__)); |
| 1567 | } |
| 1568 | add_flag(FLAGS_PROGRESSIVE_READER); |
| 1569 | return _rpa->ReadProgressiveAttachmentBy(r); |
| 1570 | } |
| 1571 | |
| 1572 | void Controller::set_mongo_session_data(MongoContext* data) { |
| 1573 | _mongo_session_data = data; |