mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 18:50:50 +00:00
LibTLS: Use a setter for on_tls_ready_to_write with some more smarts
The callback should be called as soon as the connection is established, and if we actually set the callback when it already is, we expect it to be called immediately.
This commit is contained in:
parent
d3ea0818f3
commit
436693c0c9
Notes:
sideshowbarker
2024-07-18 03:39:50 +09:00
Author: https://github.com/alimpfard
Commit: 436693c0c9
Pull-request: https://github.com/SerenityOS/serenity/pull/10103
Reviewed-by: https://github.com/awesomekling
6 changed files with 28 additions and 13 deletions
|
@ -68,6 +68,7 @@ void HttpsJob::shutdown()
|
|||
return;
|
||||
m_socket->on_tls_ready_to_read = nullptr;
|
||||
m_socket->on_tls_connected = nullptr;
|
||||
m_socket->set_on_tls_ready_to_write(nullptr);
|
||||
m_socket = nullptr;
|
||||
}
|
||||
|
||||
|
@ -97,9 +98,10 @@ void HttpsJob::register_on_ready_to_read(Function<void()> callback)
|
|||
|
||||
void HttpsJob::register_on_ready_to_write(Function<void()> callback)
|
||||
{
|
||||
m_socket->on_tls_ready_to_write = [callback = move(callback)](auto&) {
|
||||
m_socket->set_on_tls_ready_to_write([callback = move(callback)](auto& tls) {
|
||||
Core::deferred_invoke([&tls] { tls.set_on_tls_ready_to_write(nullptr); });
|
||||
callback();
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
bool HttpsJob::can_read_line() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue