mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +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:
committed by
Ali Mohammad Pur
parent
d3ea0818f3
commit
436693c0c9
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user