mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 11:36:10 +00:00
Merge 7a733ae7a7
into 8e37cd2f71
This commit is contained in:
commit
a3e33f5ea0
3 changed files with 9 additions and 6 deletions
|
@ -616,9 +616,10 @@ void ConnectionFromClient::check_active_requests()
|
|||
// FIXME: Come up with a unified way to track websockets and standard fetches instead of this nasty tagged pointer
|
||||
if (reinterpret_cast<uintptr_t>(application_private) & websocket_private_tag) {
|
||||
auto* websocket_impl = reinterpret_cast<WebSocketImplCurl*>(reinterpret_cast<uintptr_t>(application_private) & ~websocket_private_tag);
|
||||
if (msg->data.result == CURLE_OK)
|
||||
websocket_impl->did_connect();
|
||||
else
|
||||
if (msg->data.result == CURLE_OK) {
|
||||
if (websocket_impl->did_connect() == false)
|
||||
websocket_impl->on_connection_error();
|
||||
} else
|
||||
websocket_impl->on_connection_error();
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
virtual bool handshake_complete_when_connected() const override { return true; }
|
||||
|
||||
void did_connect();
|
||||
bool did_connect();
|
||||
|
||||
private:
|
||||
explicit WebSocketImplCurl(CURLM*);
|
||||
|
|
Loading…
Add table
Reference in a new issue