mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:37:45 +00:00
LibProtocol: Don't block indefinitely in stream_into's on_ready_to_read
Blocking there will lead to blocking the entire event loop, so just try to read until something has been read or we hit EOF, this allows the event loop to continue to deliver other events while a long download is happening.
This commit is contained in:
parent
dff8344336
commit
6386554cd9
1 changed files with 2 additions and 1 deletions
|
@ -43,7 +43,7 @@ void Request::stream_into_impl(T& stream)
|
|||
}
|
||||
};
|
||||
m_internal_stream_data->read_notifier->on_ready_to_read = [this, &stream] {
|
||||
constexpr size_t buffer_size = 16 * KiB;
|
||||
constexpr size_t buffer_size = 256 * KiB;
|
||||
static char buf[buffer_size];
|
||||
do {
|
||||
auto result = m_internal_stream_data->read_stream->read({ buf, buffer_size });
|
||||
|
@ -58,6 +58,7 @@ void Request::stream_into_impl(T& stream)
|
|||
// FIXME: What do we do here?
|
||||
TODO();
|
||||
}
|
||||
break;
|
||||
} while (true);
|
||||
|
||||
if (m_internal_stream_data->read_stream->is_eof())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue