mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 03:25:13 +00:00
LibWebSocket: Ensure TLS connection is opened as non-blocking
This commit is contained in:
parent
85d46a71d9
commit
752f5b18fd
Notes:
github-actions[bot]
2025-02-22 17:41:15 +00:00
Author: https://github.com/devgianlu Commit: https://github.com/LadybirdBrowser/ladybird/commit/752f5b18fdb Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3669 Reviewed-by: https://github.com/alimpfard ✅
1 changed files with 4 additions and 4 deletions
|
@ -47,13 +47,15 @@ void WebSocketImplSerenity::connect(ConnectionInfo const& connection_info)
|
|||
if (connection_info.is_secure()) {
|
||||
TLS::Options options;
|
||||
options.set_root_certificates_path(connection_info.root_certificates_path());
|
||||
options.set_blocking(false);
|
||||
|
||||
return TRY(Core::BufferedSocket<TLS::TLSv12>::create(
|
||||
TRY(TLS::TLSv12::connect(host, connection_info.url().port_or_default(), move(options)))));
|
||||
}
|
||||
|
||||
return TRY(Core::BufferedTCPSocket::create(
|
||||
TRY(Core::TCPSocket::connect(host, connection_info.url().port_or_default()))));
|
||||
auto tcp_socket = TRY(Core::TCPSocket::connect(host, connection_info.url().port_or_default()));
|
||||
TRY(tcp_socket->set_blocking(false));
|
||||
return TRY(Core::BufferedTCPSocket::create(move(tcp_socket)));
|
||||
}();
|
||||
|
||||
if (socket_result.is_error()) {
|
||||
|
@ -64,8 +66,6 @@ void WebSocketImplSerenity::connect(ConnectionInfo const& connection_info)
|
|||
}
|
||||
|
||||
m_socket = socket_result.release_value();
|
||||
MUST(m_socket->set_blocking(false));
|
||||
|
||||
m_socket->on_ready_to_read = [this] {
|
||||
on_ready_to_read();
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue