mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 10:07:15 +02:00
LibWebSocket: Fixed occasional infinite loop with TLS sockets
This was caused by a double notifier on the TLS socket, which caused the TLS code to freak out about not being able to read properly. In addition, the existing loop inside of drain_read() has been replaced by code that actually works, and which includes new warnings when the drain method is called before initialization is done or after the websocket gets closed.
This commit is contained in:
Notes:
sideshowbarker
2024-07-18 17:53:24 +09:00
Author: https://github.com/Dexesttp Commit: https://github.com/SerenityOS/serenity/commit/812875bc89c Pull-request: https://github.com/SerenityOS/serenity/pull/7232
@@ -26,15 +26,13 @@ void TLSv12WebSocketConnectionImpl::connect(ConnectionInfo const& connection)
|
||||
VERIFY(on_ready_to_read);
|
||||
m_socket = TLS::TLSv12::construct(this);
|
||||
|
||||
m_notifier = Core::Notifier::construct(m_socket->fd(), Core::Notifier::Read);
|
||||
m_notifier->on_ready_to_read = [this] {
|
||||
on_ready_to_read();
|
||||
};
|
||||
|
||||
m_socket->set_root_certificates(DefaultRootCACertificates::the().certificates());
|
||||
m_socket->on_tls_error = [this](TLS::AlertDescription) {
|
||||
on_connection_error();
|
||||
};
|
||||
m_socket->on_tls_ready_to_read = [this] {
|
||||
on_ready_to_read();
|
||||
};
|
||||
m_socket->on_tls_ready_to_write = [this] {
|
||||
on_connected();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user