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 734420 - BroadwayServer support for unix socket listening
BroadwayServer support for unix socket listening
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Broadway
3.13.x
Other All
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-08-07 12:28 UTC by Domenico Tortorella
Modified: 2014-08-15 00:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
the patch (4.36 KB, patch)
2014-08-07 12:28 UTC, Domenico Tortorella
needs-work Details | Review
updated patch (4.39 KB, patch)
2014-08-12 22:45 UTC, Domenico Tortorella
needs-work Details | Review
newly updated patch (5.49 KB, patch)
2014-08-14 11:39 UTC, Domenico Tortorella
committed Details | Review

Description Domenico Tortorella 2014-08-07 12:28:55 UTC
Created attachment 282804 [details] [review]
the patch

At the present time broadway listens only for TCP/IP incoming
display connections. This patch adds the support for listening
on unix domain sockets too, adding the broadway_server_on_unix_socket_new()
constructor and the commandline option --unixsocket [path] to broadwayd.
Comment 1 Luca Piccirillo 2014-08-10 19:27:01 UTC
Review of attachment 282804 [details] [review]:

Works well while running broadway http server behind apache mod_proxy (new ProxyPass directive implementation supports UDS).
Comment 2 Alexander Larsson 2014-08-12 11:49:21 UTC
Review of attachment 282804 [details] [review]:

::: gdk/broadway/broadway-server.c
@@ +1283,3 @@
+  if (address == NULL)
+    {
+      g_prefix_error (error, "Unspecified unix domain socket address");

This should be g_error_set(). Otherwise it will do nothing if error is not already set.
Comment 3 Domenico Tortorella 2014-08-12 22:45:07 UTC
Created attachment 283243 [details] [review]
updated patch

Fixed as in comment #2
Comment 4 Matthias Clasen 2014-08-13 23:17:15 UTC
Review of attachment 283243 [details] [review]:

The new commandline argument should also be added in docs/reference/gtk/broadwayd.xml

::: gdk/broadway/broadway-server.c
@@ +1284,3 @@
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA, "Unspecified unix domain socket address");
+      return NULL;

You're leaking the server object here

@@ +1292,3 @@
+	{
+	  g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA, "Invalid unix domain socket address %s: ", address);
+	  return NULL;

And here

@@ +1304,3 @@
+	  g_prefix_error (error, "Unable to listen to %s: ", server->address);
+	  g_object_unref (socket_address);
+	  return NULL;

And here

::: gdk/broadway/broadwayd.c
@@ +425,3 @@
     { "port", 'p', 0, G_OPTION_ARG_INT, &http_port, "Httpd port", "PORT" },
     { "address", 'a', 0, G_OPTION_ARG_STRING, &http_address, "Ip address to bind to ", "ADDRESS" },
+    { "unixsocket", 'u', 0, G_OPTION_ARG_STRING, &unixsocket_address, "Unix domain socket address", "UXSOCK" },

I'd prefer to just use "ADDRESS" as the argument name here, instead of the slang-y "UXSOCK"

@@ +494,3 @@
+    server = broadway_server_on_unix_socket_new (unixsocket_address, &error);
+#else
+    g_printerr ("Unix domain sockets unsupported\n");

Might be nicer to instead #ifdef the commandline argument, so you don't advertise a non-working argument and don't ever get here on non-UNIX platforms.
Comment 5 Domenico Tortorella 2014-08-14 08:29:56 UTC
So the same leakings are present in broadway_server_new(), since I've replicated the constructor code from there.
Comment 6 Domenico Tortorella 2014-08-14 11:39:21 UTC
Created attachment 283378 [details] [review]
newly updated patch

Fixed as in comment #4
The leaks in broadway_server_new() are reported in bug #734778
Comment 7 Matthias Clasen 2014-08-14 20:38:03 UTC
Review of attachment 283378 [details] [review]:

Looks good now, thanks
Comment 8 Matthias Clasen 2014-08-14 20:38:12 UTC
Review of attachment 283378 [details] [review]:

Looks good now, thanks