mirror of
https://gitee.com/zyjblog/oatpp.git
synced 2024-12-24 04:16:51 +08:00
Better write handling
This commit is contained in:
parent
f1d4270fe8
commit
b0f0013a93
@ -53,7 +53,17 @@ public:
|
||||
}
|
||||
|
||||
void writeToStream(const std::shared_ptr<OutputStream>& stream) override {
|
||||
stream->write(m_buffer);
|
||||
oatpp::os::io::Library::v_size progress = 0;
|
||||
while (progress < m_buffer->getSize()) {
|
||||
auto res = stream->write(&m_buffer->getData()[progress], m_buffer->getSize() - progress);
|
||||
if(res < 0) {
|
||||
if(res == oatpp::data::stream::IOStream::ERROR_IO_PIPE ||
|
||||
(res != oatpp::data::stream::IOStream::ERROR_IO_RETRY && res != oatpp::data::stream::IOStream::ERROR_IO_WAIT_RETRY)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
progress += res;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user