mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00: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:
parent
2754112a7a
commit
812875bc89
3 changed files with 24 additions and 19 deletions
|
@ -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();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue