BroadwayServer support for unix socket listening

At the present time broadway listens only for TCP/IP incoming
display connections. This patch implements 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.

https://bugzilla.gnome.org/show_bug.cgi?id=734420
This commit is contained in:
Domenico Tortorella
2014-08-14 13:30:00 +02:00
committed by Matthias Clasen
parent 269d277afe
commit 43bddd205b
4 changed files with 65 additions and 1 deletions

View File

@ -417,12 +417,16 @@ main (int argc, char *argv[])
GSocketService *listener;
char *path, *basename;
char *http_address = NULL;
char *unixsocket_address = NULL;
int http_port = 0;
char *display;
int port = 0;
const GOptionEntry entries[] = {
{ "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" },
#ifdef G_OS_UNIX
{ "unixsocket", 'u', 0, G_OPTION_ARG_STRING, &unixsocket_address, "Unix domain socket address", "ADDRESS" },
#endif
{ NULL }
};
@ -486,7 +490,11 @@ main (int argc, char *argv[])
if (http_port == 0)
http_port = 8080 + port;
server = broadway_server_new (http_address, http_port, &error);
if (unixsocket_address != NULL)
server = broadway_server_on_unix_socket_new (unixsocket_address, &error);
else
server = broadway_server_new (http_address, http_port, &error);
if (server == NULL)
{
g_printerr ("%s\n", error->message);