[Webkit-unassigned] [Bug 45197] [GTK] Need a WebSocket implementation

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 7 11:09:01 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=45197





--- Comment #4 from Dan Winship <danw at gnome.org>  2010-09-07 11:09:01 PST ---
(From update of attachment 66558)
> +        PlatformRefPtr<GSocketClient> m_socketClient;

you don't actually need to keep it around; all gio async ops hold a ref on the "source" object for the duration of the async op

> +    PlatformRefPtr<GSocketConnectable> address = g_network_address_new(url.host().utf8().data(), port);
> +    g_socket_client_connect_async(m_socketClient.get(), address.get(), 0,
> +        reinterpret_cast<GAsyncReadyCallback>(connectedCallback), this);

Use g_socket_client_connect_to_host_async() here, then you don't need to create the temporary GNetworkAddress

> +void SocketStreamHandle::stopWaitingForSocketWritability()
> +{
> +    if (!m_writeReadySource || !m_waitingForSocketWritability)
> +        return;
> +    g_source_remove(g_source_get_id(m_writeReadySource.get()));

That's equivalent to "g_source_destroy(m_writeReadySource.get());". In both cases, you can't use the source again after doing that...

> +static gboolean writeReadyCallback(GSocket*, GIOCondition condition, SocketStreamHandle* handle)
> +{
> +    if (!isActiveHandle(handle))
> +        return FALSE;
> +    if (condition & G_IO_OUT)
> +        handle->writeReady();
> +    return TRUE;
> +}

You should check if "condition & (G_IO_ERR | G_IO_HUP)" is set, and fail the connection (and return FALSE) in that case.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list