diff options
author | Ray Strode <rstrode@redhat.com> | 2015-02-03 17:13:51 -0500 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2015-02-18 17:34:12 -0500 |
commit | ca5fccc2217644ab5c4c5e8de7fa2fc8b627f63a (patch) | |
tree | a6b570a88c104a8b8a3e3970ab2ec1eee35e0738 /daemon/gdm-xdmcp-display.c | |
parent | 8b2ac7e7ac11165187c8314f8c20efec18305863 (diff) | |
download | gdm-ca5fccc2217644ab5c4c5e8de7fa2fc8b627f63a.tar.gz |
display: get rid of more simple slave code.
This commit moves GdmServer to GdmLocalDisplay, and
XDMCP connection retries to GdmXdmcpDisplay.
https://bugzilla.gnome.org/show_bug.cgi?id=744764
Diffstat (limited to 'daemon/gdm-xdmcp-display.c')
-rw-r--r-- | daemon/gdm-xdmcp-display.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/daemon/gdm-xdmcp-display.c b/daemon/gdm-xdmcp-display.c index 27f7ee5e..7241cafe 100644 --- a/daemon/gdm-xdmcp-display.c +++ b/daemon/gdm-xdmcp-display.c @@ -52,6 +52,7 @@ struct GdmXdmcpDisplayPrivate { GdmAddress *remote_address; gint32 session_number; + guint connection_attempts; }; enum { @@ -60,6 +61,8 @@ enum { PROP_SESSION_NUMBER, }; +#define MAX_CONNECT_ATTEMPTS 10 + static void gdm_xdmcp_display_class_init (GdmXdmcpDisplayClass *klass); static void gdm_xdmcp_display_init (GdmXdmcpDisplay *xdmcp_display); @@ -174,6 +177,37 @@ gdm_xdmcp_display_prepare (GdmDisplay *display) return GDM_DISPLAY_CLASS (gdm_xdmcp_display_parent_class)->prepare (display); } +static gboolean +idle_connect_to_display (GdmXdmcpDisplay *self) +{ + gboolean res; + + self->priv->connection_attempts++; + + res = gdm_display_connect (GDM_DISPLAY (self)); + if (res) { + } else { + if (self->priv->connection_attempts >= MAX_CONNECT_ATTEMPTS) { + g_warning ("Unable to connect to display after %d tries - bailing out", self->priv->connection_attempts); + gdm_display_unmanage (GDM_DISPLAY (self)); + return FALSE; + } + return TRUE; + } + + return FALSE; +} + +static void +gdm_xdmcp_display_manage (GdmDisplay *display) +{ + GdmXdmcpDisplay *self = GDM_XDMCP_DISPLAY (display); + + g_timeout_add (500, (GSourceFunc)idle_connect_to_display, self); + + GDM_DISPLAY_CLASS (gdm_xdmcp_display_parent_class)->manage (display); +} + static void gdm_xdmcp_display_class_init (GdmXdmcpDisplayClass *klass) { @@ -184,6 +218,7 @@ gdm_xdmcp_display_class_init (GdmXdmcpDisplayClass *klass) object_class->set_property = gdm_xdmcp_display_set_property; display_class->prepare = gdm_xdmcp_display_prepare; + display_class->manage = gdm_xdmcp_display_manage; g_type_class_add_private (klass, sizeof (GdmXdmcpDisplayPrivate)); |