mirror of
https://github.com/oatpp/oatpp.git
synced 2024-11-21 03:14:51 +08:00
data::stream: make transferAsync() method consistent with simple API.
This commit is contained in:
parent
08b02340c9
commit
7f5576f52e
@ -727,7 +727,11 @@ async::CoroutineStarter transferAsync(const base::ObjectHandle<ReadCallback>& re
|
||||
switch(res) {
|
||||
|
||||
case IOError::BROKEN_PIPE:
|
||||
return error<AsyncTransferError>("[oatpp::data::stream::transferAsync]: Error. ReadCallback. BROKEN_PIPE.");
|
||||
if(m_transferSize > 0) {
|
||||
return error<AsyncTransferError>("[oatpp::data::stream::transferAsync]: Error. ReadCallback. BROKEN_PIPE.");
|
||||
}
|
||||
m_inData.set(nullptr, 0);
|
||||
break;
|
||||
|
||||
case IOError::ZERO_VALUE:
|
||||
m_inData.set(nullptr, 0);
|
||||
@ -746,10 +750,13 @@ async::CoroutineStarter transferAsync(const base::ObjectHandle<ReadCallback>& re
|
||||
return repeat();
|
||||
|
||||
default:
|
||||
if(!action.isNone()) {
|
||||
return action;
|
||||
if(m_transferSize > 0) {
|
||||
if (!action.isNone()) {
|
||||
return action;
|
||||
}
|
||||
return error<AsyncTransferError>("[oatpp::data::stream::transferAsync]: Error. ReadCallback. Unknown IO error.");
|
||||
}
|
||||
return error<AsyncTransferError>("[oatpp::data::stream::transferAsync]: Error. ReadCallback. Unknown IO error.");
|
||||
m_inData.set(nullptr, 0);
|
||||
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ class ReadCallback : public oatpp::data::stream::ReadCallback {
|
||||
public:
|
||||
|
||||
v_io_size read(void *buffer, v_buff_size count, async::Action &action) override {
|
||||
OATPP_LOGE("TEST", "read(...)")
|
||||
OATPP_LOGI("TEST", "read(...)")
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
char* data = (char*) buffer;
|
||||
data[0] = 'A';
|
||||
|
Loading…
Reference in New Issue
Block a user