Skip to content

Commit

Permalink
Remove coroutine parameter from oatpp::data::stream::ReadCallback.
Browse files Browse the repository at this point in the history
  • Loading branch information
lganzzzo committed Sep 20, 2019
1 parent cb9b2b2 commit 4422011
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 16 deletions.
5 changes: 1 addition & 4 deletions src/oatpp/core/data/stream/Stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,14 +539,11 @@ class AsyncReadCallback {

/**
* Async-Inline read callback.
* @param coroutine - caller coroutine.
* @param inlineData - &id:oatpp::data::stream::AsyncInlineReadData;.
* @param nextAction - next action when read finished.
* @return - &id:oatpp::async::Action;.
*/
virtual oatpp::async::Action readAsyncInline(oatpp::async::AbstractCoroutine* coroutine,
AsyncInlineReadData& inlineData,
oatpp::async::Action&& nextAction) = 0;
virtual oatpp::async::Action readAsyncInline(AsyncInlineReadData& inlineData, oatpp::async::Action&& nextAction) = 0;

};

Expand Down
2 changes: 1 addition & 1 deletion src/oatpp/web/protocol/http/outgoing/ChunkedBody.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ oatpp::async::CoroutineStarter ChunkedBody::writeToStreamAsync(const std::shared
}

Action readCallback() {
return m_body->m_asyncReadCallback->readAsyncInline(this, m_inlineReadData, yieldTo(&WriteCoroutine::onChunkRead));
return m_body->m_asyncReadCallback->readAsyncInline(m_inlineReadData, yieldTo(&WriteCoroutine::onChunkRead));
}

Action onChunkRead() {
Expand Down
4 changes: 1 addition & 3 deletions src/oatpp/web/protocol/http/outgoing/MultipartBody.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,9 @@ MultipartBody::AsyncMultipartReadCallback::AsyncMultipartReadCallback(const std:
, m_readStream(nullptr, nullptr, 0)
{}

oatpp::async::Action MultipartBody::AsyncMultipartReadCallback::readAsyncInline(oatpp::async::AbstractCoroutine* coroutine,
oatpp::data::stream::AsyncInlineReadData& inlineData,
oatpp::async::Action MultipartBody::AsyncMultipartReadCallback::readAsyncInline(oatpp::data::stream::AsyncInlineReadData& inlineData,
oatpp::async::Action&& nextAction)
{
(void)coroutine;

class ReadCoroutine : public oatpp::async::Coroutine<ReadCoroutine> {
private:
Expand Down
4 changes: 1 addition & 3 deletions src/oatpp/web/protocol/http/outgoing/MultipartBody.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ class MultipartBody : public ChunkedBody {

AsyncMultipartReadCallback(const std::shared_ptr<Multipart>& multipart);

oatpp::async::Action readAsyncInline(oatpp::async::AbstractCoroutine* coroutine,
oatpp::data::stream::AsyncInlineReadData& inlineData,
oatpp::async::Action&& nextAction) override;
oatpp::async::Action readAsyncInline(oatpp::data::stream::AsyncInlineReadData& inlineData, oatpp::async::Action&& nextAction) override;

};

Expand Down
6 changes: 1 addition & 5 deletions test/oatpp/web/app/ControllerAsync.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,7 @@ class ControllerAsync : public oatpp::web::server::api::ApiController {
, m_iterations(iterations)
{}

oatpp::async::Action readAsyncInline(oatpp::async::AbstractCoroutine* coroutine,
oatpp::data::stream::AsyncInlineReadData& inlineData,
oatpp::async::Action&& nextAction) override
{
(void)coroutine;
oatpp::async::Action readAsyncInline(oatpp::data::stream::AsyncInlineReadData& inlineData, oatpp::async::Action&& nextAction) override {
if(m_counter < m_iterations) {
std::memcpy(inlineData.currBufferPtr, m_text->getData(), m_text->getSize());
inlineData.inc(m_text->getSize());
Expand Down

0 comments on commit 4422011

Please sign in to comment.