GNOME Bugzilla – Bug 728207
gsocketservice: Documentation does not mention that is already active when it is created
Last modified: 2016-07-17 01:12:24 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 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.
(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."
Attachment 274305 [details] pushed as e3e3ed0 - socketservice: Document that it starts pre-activated.