RequestServer: Don't assert for socket fd not being CURL_SOCKET_BAD
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

The assertion in `WebSocketImplCurl::did_connect()` keeps failing for
multiple websockets when loading `https://www.speedtest.net/` since
commit 14ebcd4. This fixes that by checking and returning false if
something went wrong and letting the caller function handle it.
This commit is contained in:
Mohamed amine Bounya 2025-03-14 01:13:04 +00:00 committed by Andrew Kaster
commit b77643a2e8
Notes: github-actions[bot] 2025-05-01 00:21:27 +00:00
3 changed files with 10 additions and 6 deletions

View file

@ -160,11 +160,12 @@ void WebSocketImplCurl::discard_connection()
}
}
void WebSocketImplCurl::did_connect()
bool WebSocketImplCurl::did_connect()
{
curl_socket_t socket_fd = CURL_SOCKET_BAD;
auto res = curl_easy_getinfo(m_easy_handle, CURLINFO_ACTIVESOCKET, &socket_fd);
VERIFY(res == CURLE_OK && socket_fd != CURL_SOCKET_BAD);
if (res != CURLE_OK || socket_fd == CURL_SOCKET_BAD)
return false;
m_read_notifier = Core::Notifier::construct(socket_fd, Core::Notifier::Type::Read);
m_read_notifier->on_activation = [this] {
@ -190,6 +191,7 @@ void WebSocketImplCurl::did_connect()
};
on_connected();
return true;
}
}