diff options
author | runge <runge@karlrunge.com> | 2009-12-07 09:15:22 -0500 |
---|---|---|
committer | runge <runge@karlrunge.com> | 2009-12-07 09:15:22 -0500 |
commit | 8f5c9ef01ef9101cf8f8d8f1eacdaab27ac7c2c8 (patch) | |
tree | b56c0f6b003075bffc43cae033c647ab31eeff60 /x11vnc/cleanup.c | |
parent | 6153bd69835da0e7217ae844bdba4e2ba676f981 (diff) | |
download | libtdevnc-8f5c9ef01ef9101cf8f8d8f1eacdaab27ac7c2c8.tar.gz libtdevnc-8f5c9ef01ef9101cf8f8d8f1eacdaab27ac7c2c8.zip |
X11VNC_EXTRA_HTTPS_PARAMS, X11VNC_HTTP_LISTEN_LOCALHOST, X11VNC_REOPEN_SLEEP_MAX,
-findauth/-auth guess FD_XDM=1 for root, work around xhost SI:localuser:root.
Diffstat (limited to 'x11vnc/cleanup.c')
-rw-r--r-- | x11vnc/cleanup.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/x11vnc/cleanup.c b/x11vnc/cleanup.c index 5d2339d..834c567 100644 --- a/x11vnc/cleanup.c +++ b/x11vnc/cleanup.c @@ -325,13 +325,23 @@ static int XIOerr(Display *d) { #if !NO_X11 if (reopen < rmax && getenv("X11VNC_REOPEN_DISPLAY")) { int db = getenv("X11VNC_REOPEN_DEBUG") ? 1 : 0; + int sleepmax = 10, i; Display *save_dpy = dpy; - char *dstr = DisplayString(save_dpy); + char *dstr = strdup(DisplayString(save_dpy)); reopen++; + if (getenv("X11VNC_REOPEN_SLEEP_MAX")) { + sleepmax = atoi(getenv("X11VNC_REOPEN_SLEEP_MAX")); + } rfbLog("*** XIO error: Trying to reopen[%d/%d] display '%s'\n", reopen, rmax, dstr); rfbLog("*** XIO error: Note the reopened state may be unstable.\n"); - usleep (3000 * 1000); - dpy = XOpenDisplay_wr(dstr); + for (i=0; i < sleepmax; i++) { + usleep (1000 * 1000); + dpy = XOpenDisplay_wr(dstr); + rfbLog("dpy[%d/%d]: %p\n", i+1, sleepmax, dpy); + if (dpy) { + break; + } + } last_open_xdisplay = time(NULL); if (dpy) { rfbLog("*** XIO error: Reopened display '%s' successfully.\n", dstr); @@ -353,6 +363,7 @@ static int XIOerr(Display *d) { do_new_fb(1); if (db) rfbLog("*** XIO error: check_xevents\n"); check_xevents(1); + /* sadly, we can never return... */ if (db) rfbLog("*** XIO error: watch_loop\n"); watch_loop(); |