After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 586797 - Add GCancellables to GSocket ops
Add GCancellables to GSocket ops
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: network
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
: 585905 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-06-23 21:51 UTC by Dan Winship
Modified: 2009-07-07 08:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add GCancellables to GSocket ops (22.54 KB, patch)
2009-06-23 21:55 UTC, Dan Winship
committed Details | Review

Description Dan Winship 2009-06-23 21:51:59 UTC
Currently, to implement cancellability correctly, all synchronous
calls to GSocket must be preceded by a g_socket_condition_wait() call,
(even though GSocket does this internally as well) and all
asynchronous calls must do occasional manual
g_cancellable_is_cancelled() checks. Since it's trivial to do these
checks inside GSocket instead, and we don't particularly want to
encourage people to use the APIs non-cancellably, move the
cancellation support into GSocket and simplify the existing callers.
Comment 1 Dan Winship 2009-06-23 21:55:42 UTC
Created attachment 137276 [details] [review]
Add GCancellables to GSocket ops
Comment 2 Dan Winship 2009-06-23 21:59:33 UTC
messed up with git bz a bit and lost part of the first comment...

It made some sense to not have cancellables in the GSocket API initially, what with the whole "very thin wrapper over sockets" philosophy. But given that all the blocking GSocket operations now call g_socket_condition_wait() internally, it's basically just cruel to force the apps to call it themselves before calling the op as well. And some places weren't bothering (like the g_socket_connect() calls in GSocketClient, so those became non-cancellable in the synchronous version).

Also, this makes it totally clear which operations can block and which ones can't.
Comment 3 Alexander Larsson 2009-06-30 15:28:50 UTC
even though i nak:ed a similar change I must say that this patch looks pretty minimal and has clear advantages, please commit.
Comment 4 Dan Winship 2009-06-30 16:07:37 UTC
committed with minor updates for recent gio changes
Comment 5 Allison Karlitskaya (desrt) 2009-07-07 08:49:48 UTC
*** Bug 585905 has been marked as a duplicate of this bug. ***