mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2025-01-05 21:48:49 +01:00
vncserver: slice start time from 3 seconds to ~170ms
This commit is contained in:
parent
2b4f01f5ae
commit
cc90fe9ff6
@ -25,6 +25,8 @@
|
||||
# vncserver - wrapper script to start an X VNC server.
|
||||
#
|
||||
|
||||
use Time::HiRes qw (sleep);
|
||||
|
||||
&DetectEnvironment();
|
||||
|
||||
&SetGlobalVariables();
|
||||
@ -41,7 +43,6 @@ $pidFile = "$vncUserDir/$host:$displayNumber.pid";
|
||||
|
||||
$kasmAuthEnabled = 1;
|
||||
&DisableVncAuth();
|
||||
|
||||
if ($kasmAuthEnabled) {
|
||||
&EnsureAtLeastOneKasmUserExists();
|
||||
}
|
||||
@ -54,11 +55,11 @@ $cmd = &ConstructXvncCmd();
|
||||
|
||||
&DeleteLogLeftFromPreviousXvncRun();
|
||||
&StartXvncAndRecordPID();
|
||||
&WaitForXvncToStart();
|
||||
&WaitForXvncToRespond();
|
||||
|
||||
if (!&IsXvncRunning() && !&UsingSafeFontPath()) {
|
||||
&StartXvncWithSafeFontPath();
|
||||
&WaitForXvncToStart();
|
||||
&WaitForXvncToRespond();
|
||||
}
|
||||
|
||||
unless (&IsXvncRunning()) {
|
||||
@ -956,8 +957,20 @@ sub WarnUserXvncNotStartedAndExit {
|
||||
die "\n";
|
||||
}
|
||||
|
||||
sub WaitForXvncToStart {
|
||||
sleep(3);
|
||||
sub WaitForXvncToRespond {
|
||||
my $sleepSlice = 0.1;
|
||||
my $sleptFor = 0;
|
||||
my $sleepLimit = 3;
|
||||
|
||||
until (&IsXvncResponding() || $sleptFor >= $sleepLimit) {
|
||||
sleep($sleepSlice);
|
||||
$sleptFor += $sleepSlice;
|
||||
}
|
||||
}
|
||||
|
||||
sub IsXvncResponding {
|
||||
`xdpyinfo -display :$displayNumber >/dev/null 2>&1`;
|
||||
$? == 0;
|
||||
}
|
||||
|
||||
sub UsingSafeFontPath {
|
||||
|
Loading…
Reference in New Issue
Block a user