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 728207 - gsocketservice: Documentation does not mention that is already active when it is created
gsocketservice: Documentation does not mention that is already active when it...
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: network
2.40.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2014-04-14 20:00 UTC by Olivier Crête
Modified: 2016-07-17 01:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
socketservice: Document that it starts pre-activated. (1.83 KB, patch)
2014-04-14 20:00 UTC, Olivier Crête
committed Details | Review

Description Olivier Crête 2014-04-14 20:00:17 UTC
Created attachment 274305 [details] [review]
socketservice: Document that it starts pre-activated.

The behavior of GSocketService is odd, it has a start() and a stop() method, but it actually is created in the "active" state, so calling _start() the first time isn't required. But if a socket is added, calling _stop() is, even if _start() has never been called. I guess it's too late to change that behaviour, so the best we can do is to document it.
Comment 1 Dan Winship 2014-05-01 15:38:57 UTC
Comment on attachment 274305 [details] [review]
socketservice: Document that it starts pre-activated.

>+ * Restarts the service, i.e. start accepting connections
>+ * from the added sockets when the mainloop runs. This only needs
>+ * to be called after the service has been stopped from
>+ * g_socket_service_stop().

might want to say explicitly "The service is already active when it is first created, so this only needs to be called..."

>+ * This must be called before calling g_socket_listener_close() as
>+ * the socket service will start accepting connections immediately
>+ * when a new socket is added.

Hm... We should make g_socket_listener_close() be a virtual method so that GSocketService can override it and stop itself.
Comment 2 Olivier Crête 2014-05-01 15:48:20 UTC
(In reply to comment #1)
> (From update of attachment 274305 [details] [review])
> >+ * This must be called before calling g_socket_listener_close() as
> >+ * the socket service will start accepting connections immediately
> >+ * when a new socket is added.
> 
> Hm... We should make g_socket_listener_close() be a virtual method so that
> GSocketService can override it and stop itself.

Even if we change it, we would still need to say, "in versions before 2.42, this must be called before calling g_socket_listener_close() as the socket service will start accepting connections immediately when a new socket is added."
Comment 3 Matthias Clasen 2016-07-17 01:12:20 UTC
Attachment 274305 [details] pushed as e3e3ed0 - socketservice: Document that it starts pre-activated.