[gtk+/wip/alexl/broadway4: 2/5] broadway: Only support (non-abstract) sockets
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/alexl/broadway4: 2/5] broadway: Only support (non-abstract) sockets
- Date: Sat, 18 Nov 2017 11:22:36 +0000 (UTC)
commit 92788c9a5d2208f5d1d146e84856fc473b5430e7
Author: Alexander Larsson <alexl redhat com>
Date: Fri Nov 17 14:16:01 2017 +0100
broadway: Only support (non-abstract) sockets
We want to use fd passing, so drop tcp
gdk/broadway/broadwayd.c | 27 +++++----------------------
gdk/broadway/gdkbroadway-server.c | 26 ++++----------------------
2 files changed, 9 insertions(+), 44 deletions(-)
---
diff --git a/gdk/broadway/broadwayd.c b/gdk/broadway/broadwayd.c
index 8e96d6e..f9ca737 100644
--- a/gdk/broadway/broadwayd.c
+++ b/gdk/broadway/broadwayd.c
@@ -413,7 +413,6 @@ main (int argc, char *argv[])
GError *error = NULL;
GOptionContext *context;
GMainLoop *loop;
- GInetAddress *inet;
GSocketAddress *address;
GSocketService *listener;
char *http_address = NULL;
@@ -456,26 +455,9 @@ main (int argc, char *argv[])
}
if (display == NULL)
- {
-#ifdef G_OS_UNIX
- if (g_unix_socket_address_abstract_names_supported ())
- display = ":0";
- else
-#endif
- display = ":tcp";
- }
+ display = ":0";
- if (g_str_has_prefix (display, ":tcp"))
- {
- port = strtol (display + strlen (":tcp"), NULL, 10);
-
- inet = g_inet_address_new_from_string ("127.0.0.1");
- g_print ("Listening on 127.0.0.1:%d\n", port + 9090);
- address = g_inet_socket_address_new (inet, port + 9090);
- g_object_unref (inet);
- }
-#ifdef G_OS_UNIX
- else if (display[0] == ':' && g_ascii_isdigit(display[1]))
+ if (display[0] == ':' && g_ascii_isdigit(display[1]))
{
char *path, *basename;
@@ -484,12 +466,13 @@ main (int argc, char *argv[])
path = g_build_filename (g_get_user_runtime_dir (), basename, NULL);
g_free (basename);
+ unlink (path);
+
g_print ("Listening on %s\n", path);
address = g_unix_socket_address_new_with_type (path, -1,
- G_UNIX_SOCKET_ADDRESS_ABSTRACT);
+ G_UNIX_SOCKET_ADDRESS_PATH);
g_free (path);
}
-#endif
else
{
g_printerr ("Failed to parse display %s\n", display);
diff --git a/gdk/broadway/gdkbroadway-server.c b/gdk/broadway/gdkbroadway-server.c
index 2aa98ab..d81690e 100644
--- a/gdk/broadway/gdkbroadway-server.c
+++ b/gdk/broadway/gdkbroadway-server.c
@@ -97,7 +97,6 @@ _gdk_broadway_server_new (const char *display, GError **error)
GdkBroadwayServer *server;
GSocketClient *client;
GSocketConnection *connection;
- GInetAddress *inet;
GSocketAddress *address;
GPollableInputStream *pollable;
GInputStream *in;
@@ -106,25 +105,9 @@ _gdk_broadway_server_new (const char *display, GError **error)
int port;
if (display == NULL)
- {
-#ifdef G_OS_UNIX
- if (g_unix_socket_address_abstract_names_supported ())
- display = ":0";
- else
-#endif
- display = ":tcp";
- }
+ display = ":0";
- if (g_str_has_prefix (display, ":tcp"))
- {
- port = 9090 + strtol (display + strlen (":tcp"), NULL, 10);
-
- inet = g_inet_address_new_from_string ("127.0.0.1");
- address = g_inet_socket_address_new (inet, port);
- g_object_unref (inet);
- }
-#ifdef G_OS_UNIX
- else if (display[0] == ':' && g_ascii_isdigit(display[1]))
+ if (display[0] == ':' && g_ascii_isdigit(display[1]))
{
char *path, *basename;
@@ -134,14 +117,13 @@ _gdk_broadway_server_new (const char *display, GError **error)
g_free (basename);
address = g_unix_socket_address_new_with_type (path, -1,
- G_UNIX_SOCKET_ADDRESS_ABSTRACT);
+ G_UNIX_SOCKET_ADDRESS_PATH);
g_free (path);
}
-#endif
else
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
- _("Broadway display type not supported: %s"), display);
+ _("Broadway display type not supported: %s"), display);
return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]