mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
LibTLS: Call the read hooks after processing messages too
Otherwise the notification would be deferred until the next read event, which means the client will not get any events if the server initiates the appdata transfers.
This commit is contained in:
parent
e72235b981
commit
cb134cd702
Notes:
sideshowbarker
2024-07-18 19:12:06 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/cb134cd702a Pull-request: https://github.com/SerenityOS/serenity/pull/6581
1 changed files with 18 additions and 5 deletions
|
@ -140,16 +140,29 @@ bool TLSv12::common_connect(const struct sockaddr* saddr, socklen_t length)
|
|||
|
||||
void TLSv12::read_from_socket()
|
||||
{
|
||||
if (m_context.application_buffer.size() > 0) {
|
||||
deferred_invoke([&](auto&) { read_from_socket(); });
|
||||
if (on_tls_ready_to_read)
|
||||
on_tls_ready_to_read(*this);
|
||||
}
|
||||
auto did_schedule_read = false;
|
||||
auto notify_client_for_app_data = [&] {
|
||||
if (m_context.application_buffer.size() > 0) {
|
||||
if (!did_schedule_read) {
|
||||
deferred_invoke([&](auto&) { read_from_socket(); });
|
||||
did_schedule_read = true;
|
||||
}
|
||||
if (on_tls_ready_to_read)
|
||||
on_tls_ready_to_read(*this);
|
||||
}
|
||||
};
|
||||
|
||||
// If there's anything before we consume stuff, let the client know
|
||||
// since we won't be consuming things if the connection is terminated.
|
||||
notify_client_for_app_data();
|
||||
|
||||
if (!check_connection_state(true))
|
||||
return;
|
||||
|
||||
consume(Core::Socket::read(4096));
|
||||
|
||||
// If anything new shows up, tell the client about the event.
|
||||
notify_client_for_app_data();
|
||||
}
|
||||
|
||||
void TLSv12::write_into_socket()
|
||||
|
|
Loading…
Reference in a new issue