summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--daemon/gdm.c2
-rw-r--r--daemon/gdm.h1
-rw-r--r--daemon/slave.c58
-rw-r--r--docs/C/gdm.sgml13
-rw-r--r--gui/gdmconfig-strings.c2
-rw-r--r--gui/gdmconfig.c2
-rw-r--r--gui/gdmconfig.glade66
8 files changed, 147 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 3003388b..5c30f578 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed May 30 16:19:39 2001 George Lebl <jirka@5z.com>
+
+ * daemon/gdm.[ch], daemon/slave.c, gui/gdmconfig.(c|glade):
+ Add a PingInterval xdmcp thingie which is a combination of
+ the xdm PingInterval and PingTimeout.
+
2001-05-30 Havoc Pennington <hp@redhat.com>
* configure.in (ALL_LINGUAS): remove ja.po and zh_TW.Big5.po.
diff --git a/daemon/gdm.c b/daemon/gdm.c
index 2684371e..3fbfcc48 100644
--- a/daemon/gdm.c
+++ b/daemon/gdm.c
@@ -108,6 +108,7 @@ gint GdmPort = 0;
gboolean GdmIndirect = FALSE;
gint GdmMaxIndirect = 0;
gint GdmMaxIndirectWait = 0;
+gint GdmPingInterval = 0;
gboolean GdmDebug = FALSE;
gboolean GdmVerboseAuth = FALSE;
gboolean GdmAllowRoot = FALSE;
@@ -203,6 +204,7 @@ gdm_config_parse (void)
GdmIndirect = gnome_config_get_bool (GDM_KEY_INDIRECT);
GdmMaxIndirect = gnome_config_get_int (GDM_KEY_MAXINDIR);
GdmMaxIndirectWait = gnome_config_get_int (GDM_KEY_MAXINDWAIT);
+ GdmPingInterval = gnome_config_get_int (GDM_KEY_PINGINTERVAL);
GdmDebug = gnome_config_get_bool (GDM_KEY_DEBUG);
diff --git a/daemon/gdm.h b/daemon/gdm.h
index f7224611..18697adb 100644
--- a/daemon/gdm.h
+++ b/daemon/gdm.h
@@ -147,6 +147,7 @@
#define GDM_KEY_INDIRECT "xdmcp/HonorIndirect=false"
#define GDM_KEY_MAXINDIR "xdmcp/MaxPendingIndirect=4"
#define GDM_KEY_MAXINDWAIT "xdmcp/MaxWaitIndirect=30"
+#define GDM_KEY_PINGINTERVAL "xdmcp/PingInterval=5"
#define GDM_KEY_GTKRC "gui/GtkRC=" EXPANDED_DATADIR "/themes/Default/gtk/gtkrc"
#define GDM_KEY_ICONWIDTH "gui/MaxIconWidth=128"
diff --git a/daemon/slave.c b/daemon/slave.c
index 88a72103..84652794 100644
--- a/daemon/slave.c
+++ b/daemon/slave.c
@@ -92,6 +92,7 @@ extern gint GdmUserMaxFile;
extern gint GdmSessionMaxFile;
extern gint GdmRelaxPerms;
extern gboolean GdmKillInitClients;
+extern gint GdmPingInterval;
extern gint GdmRetryDelay;
extern gboolean GdmAllowRoot;
extern sigset_t sysmask;
@@ -109,6 +110,7 @@ static void gdm_slave_greeter (void);
static void gdm_slave_session_start (void);
static void gdm_slave_session_stop (pid_t sesspid);
static void gdm_slave_session_cleanup (void);
+static void gdm_slave_alrm_handler (int sig);
static void gdm_slave_term_handler (int sig);
static void gdm_slave_child_handler (int sig);
static void gdm_slave_exit (gint status, const gchar *format, ...);
@@ -120,12 +122,24 @@ gdm_slave_start (GdmDisplay *display)
{
time_t first_time;
int death_count;
- struct sigaction term, child;
+ struct sigaction alrm, term, child;
if (!display)
return;
gdm_debug ("gdm_slave_start: Starting slave process for %s", display->name);
+ if (d->type != TYPE_LOCAL &&
+ GdmPingInterval > 0) {
+ /* Handle a ALRM signals from our ping alarms */
+ alrm.sa_handler = gdm_slave_alrm_handler;
+ alrm.sa_flags = SA_RESTART | SA_NODEFER;
+ sigemptyset (&alrm.sa_mask);
+ sigaddset (&alrm.sa_mask, SIGALRM);
+
+ if (sigaction (SIGALRM, &alrm, NULL) < 0)
+ gdm_slave_exit (DISPLAY_ABORT, _("gdm_slave_init: Error setting up ALRM signal handler"));
+ }
+
/* Handle a INT/TERM signals from gdm master */
term.sa_handler = gdm_slave_term_handler;
term.sa_flags = SA_RESTART;
@@ -151,6 +165,10 @@ gdm_slave_start (GdmDisplay *display)
sigdelset (&mask, SIGINT);
sigdelset (&mask, SIGTERM);
sigdelset (&mask, SIGCHLD);
+ if (d->type != TYPE_LOCAL &&
+ GdmPingInterval > 0) {
+ sigdelset (&mask, SIGALRM);
+ }
sigprocmask (SIG_SETMASK, &mask, NULL);
first_time = time (NULL);
@@ -311,6 +329,12 @@ gdm_slave_run (GdmDisplay *display)
if (d->dsp != NULL) {
+ /* If XDMCP setup pinging */
+ if (d->type != TYPE_LOCAL &&
+ GdmPingInterval > 0) {
+ alarm (GdmPingInterval * 60);
+ }
+
/* checkout xinerama */
gdm_screen_init (d);
@@ -419,7 +443,7 @@ focus_first_x_window (const char *class_res_name)
event.xmap.window,
RevertToPointerRoot,
CurrentTime);
- XSync (disp, True);
+ XSync (disp, False);
XCloseDisplay (disp);
_exit (0);
@@ -1752,6 +1776,36 @@ gdm_slave_term_handler (int sig)
_exit (DISPLAY_ABORT);
}
+/* called on alarms to ping */
+static void
+gdm_slave_alrm_handler (int sig)
+{
+ static gboolean in_ping = FALSE;
+
+ gdm_debug ("gdm_slave_alrm_handler: %s got ARLM signal, "
+ "to ping display", d->name);
+
+ if (d->dsp == NULL) {
+ /* huh? */
+ return;
+ }
+
+ if (in_ping) {
+ /* darn, the last ping didn't succeed, abort this display */
+ gdm_slave_exit (DISPLAY_REMANAGE,
+ _("Ping to %s failed, whacking display!"),
+ d->name);
+ }
+
+ in_ping = TRUE;
+
+ /* schedule next alarm */
+ alarm (GdmPingInterval * 60);
+
+ XSync (d->dsp, True);
+
+ in_ping = FALSE;
+}
/* Called on every SIGCHLD */
static void
diff --git a/docs/C/gdm.sgml b/docs/C/gdm.sgml
index 6309bc65..27afc40d 100644
--- a/docs/C/gdm.sgml
+++ b/docs/C/gdm.sgml
@@ -1177,6 +1177,19 @@
</para>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term>PingInterval</term>
+ <listitem>
+ <synopsis>PingInterval=5</synopsis>
+ <para>
+ Interval in which to ping the X server in minutes. If the
+ X server doesn't return before the next time we ping it,
+ the connection is stopped and the session ended. This is
+ a combination of the xdm PingInterval and PingTimeout.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
</sect2>
diff --git a/gui/gdmconfig-strings.c b/gui/gdmconfig-strings.c
index b65f5e79..f228bed8 100644
--- a/gui/gdmconfig-strings.c
+++ b/gui/gdmconfig-strings.c
@@ -167,6 +167,8 @@ gchar *s = N_("Maximum remote sessions: ");
gchar *s = N_("Max pending indirect requests: ");
gchar *s = N_("Maximum pending requests: ");
gchar *s = N_("Listen on UDP port: ");
+gchar *s = N_("Ping interval (minutes):");
+gchar *s = N_("Interval in minutes in which to ping the server. If the server doesn't respond in this many minutes (that is before the next time we ping it) the display will be terminated.");
gchar *s = N_("XDMCP");
gchar *s = N_("Server Definitions");
gchar *s = N_("No.");
diff --git a/gui/gdmconfig.c b/gui/gdmconfig.c
index 3ce212f4..9e2de53a 100644
--- a/gui/gdmconfig.c
+++ b/gui/gdmconfig.c
@@ -623,6 +623,7 @@ gdm_config_parse_most (gboolean factory)
gdm_spin_set("max_sessions", gnome_config_get_int(GDM_KEY_MAXSESS));
gdm_spin_set("max_wait_time", gnome_config_get_int(GDM_KEY_MAXWAIT));
gdm_spin_set("max_indirect_wait_time", gnome_config_get_int(GDM_KEY_MAXINDWAIT));
+ gdm_spin_set("ping_interval", gnome_config_get_int(GDM_KEY_PINGINTERVAL));
/* Fill the widgets in User Interface tab */
@@ -1026,6 +1027,7 @@ write_config (void)
gdm_spin_write("max_sessions", GDM_KEY_MAXSESS);
gdm_spin_write("max_wait_time", GDM_KEY_MAXWAIT);
gdm_spin_write("max_indirect_wait_time", GDM_KEY_MAXINDWAIT);
+ gdm_spin_write("ping_interval", GDM_KEY_PINGINTERVAL);
/* Write out the widget contents of the User Interface tab */
diff --git a/gui/gdmconfig.glade b/gui/gdmconfig.glade
index 81ccbd2d..b2c23d03 100644
--- a/gui/gdmconfig.glade
+++ b/gui/gdmconfig.glade
@@ -3328,7 +3328,7 @@ tr_TR
<class>GtkTable</class>
<name>table9</name>
<border_width>3</border_width>
- <rows>6</rows>
+ <rows>7</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>3</row_spacing>
@@ -3716,6 +3716,70 @@ tr_TR
<yfill>False</yfill>
</child>
</widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label256</name>
+ <label>Ping interval (minutes):</label>
+ <justify>GTK_JUSTIFY_LEFT</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>6</top_attach>
+ <bottom_attach>7</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkSpinButton</class>
+ <name>ping_interval</name>
+ <tooltip>Interval in minutes in which to ping the server. If the server doesn't respond in this many minutes (that is before the next time we ping it) the display will be terminated.</tooltip>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>changed</name>
+ <handler>can_apply_now</handler>
+ <last_modification_time>Tue, 21 Mar 2000 21:36:20 GMT</last_modification_time>
+ </signal>
+ <climb_rate>1</climb_rate>
+ <digits>0</digits>
+ <numeric>False</numeric>
+ <update_policy>GTK_UPDATE_ALWAYS</update_policy>
+ <snap>False</snap>
+ <wrap>False</wrap>
+ <value>1</value>
+ <lower>0</lower>
+ <upper>100</upper>
+ <step>1</step>
+ <page>10</page>
+ <page_size>10</page_size>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>6</top_attach>
+ <bottom_attach>7</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
</widget>
</widget>
</widget>