diff options
author | Jay Sorg <jay.sorg@gmail.com> | 2013-08-24 18:53:55 -0700 |
---|---|---|
committer | Jay Sorg <jay.sorg@gmail.com> | 2013-08-24 18:53:55 -0700 |
commit | 6700eb18d759a1e61786e299f986ae5995d7f208 (patch) | |
tree | bc26aca6d7eff8e48cbc1e506c48e4d8e9bd45a5 /xorg/X11R7.6/rdp | |
parent | 069838f3557f584932a6372a72b3ad0155fcc761 (diff) | |
download | xrdp-proprietary-6700eb18d759a1e61786e299f986ae5995d7f208.tar.gz xrdp-proprietary-6700eb18d759a1e61786e299f986ae5995d7f208.zip |
kill disconencted, make work like man page and update man page
Diffstat (limited to 'xorg/X11R7.6/rdp')
-rw-r--r-- | xorg/X11R7.6/rdp/rdpup.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/xorg/X11R7.6/rdp/rdpup.c b/xorg/X11R7.6/rdp/rdpup.c index 325ee492..b8a763a7 100644 --- a/xorg/X11R7.6/rdp/rdpup.c +++ b/xorg/X11R7.6/rdp/rdpup.c @@ -137,14 +137,14 @@ static int g_rdp_opcodes[16] = static int g_do_kill_disconnected = 0; /* turn on or off */ static OsTimerPtr g_dis_timer = 0; static int g_disconnect_scheduled = 0; -static CARD32 g_disconnect_timeout = 60 * 1000; /* 60 seconds */ -static CARD32 g_disconnect_time = 0; /* time of disconnect */ +static CARD32 g_disconnect_timeout_s = 60; /* 60 seconds */ +static CARD32 g_disconnect_time_ms = 0; /* time of disconnect in milliseconds */ /******************************************************************************/ static CARD32 rdpDeferredDisconnectCallback(OsTimerPtr timer, CARD32 now, pointer arg) { - CARD32 lnow; + CARD32 lnow_ms; LLOGLN(10, ("rdpDeferredDisconnectCallback")); if (g_connected) @@ -165,8 +165,8 @@ rdpDeferredDisconnectCallback(OsTimerPtr timer, CARD32 now, pointer arg) { LLOGLN(10, ("rdpDeferredDisconnectCallback: not connected")); } - lnow = GetTimeInMillis(); - if (lnow - g_disconnect_time > g_disconnect_timeout) + lnow_ms = GetTimeInMillis(); + if (lnow_ms - g_disconnect_time_ms > g_disconnect_timeout_s * 1000) { LLOGLN(0, ("rdpDeferredDisconnectCallback: exit X11rdp")); kill(getpid(), SIGTERM); @@ -192,7 +192,7 @@ rdpup_disconnect(void) rdpDeferredDisconnectCallback, 0); g_disconnect_scheduled = 1; } - g_disconnect_time = GetTimeInMillis(); + g_disconnect_time_ms = GetTimeInMillis(); } RemoveEnabledDevice(g_sck); @@ -1063,20 +1063,31 @@ rdpup_init(void) ptext = getenv("XRDP_SESMAN_MAX_DISC_TIME"); if (ptext != 0) { - g_disconnect_timeout = atoi(ptext); + i = atoi(ptext); + if (i > 0) + { + g_do_kill_disconnected = 1; + g_disconnect_timeout_s = atoi(ptext); + } } ptext = getenv("XRDP_SESMAN_KILL_DISCONNECTED"); if (ptext != 0) { - g_do_kill_disconnected = atoi(ptext); + i = atoi(ptext); + if (i != 0) + { + g_do_kill_disconnected = 1; + g_disconnect_timeout_s = 0; + } } - if (g_disconnect_timeout == 0) + if (g_do_kill_disconnected && (g_disconnect_timeout_s < 60)) { - g_do_kill_disconnected = 0; + g_disconnect_timeout_s = 60; } - rdpLog("kill disconencted [%d] timeout [%d]\n", g_do_kill_disconnected, - g_disconnect_timeout); + + rdpLog("kill disconencted [%d] timeout [%d] sec\n", g_do_kill_disconnected, + g_disconnect_timeout_s); return 1; } |