x11vnc: -ping option, fix memory corruption in copy_tiles after xrandr resize.

pull/1/head
runge 17 years ago
parent 649f5b2b46
commit c07091b390

@ -1,3 +1,7 @@
2008-01-14 Karl Runge <runge@karlrunge.com>
* x11vnc: -ping option, fix memory corruption in copy_tiles
after xrandr resize.
2007-12-16 Karl Runge <runge@karlrunge.com> 2007-12-16 Karl Runge <runge@karlrunge.com>
* x11vnc: setup remote-ctrl file by default on macosx. improve * x11vnc: setup remote-ctrl file by default on macosx. improve
tkx11vnc wrt attaching to existing server in icon/tray mode. tkx11vnc wrt attaching to existing server in icon/tray mode.

@ -1,5 +1,5 @@
x11vnc README file Date: Sun Dec 16 13:21:20 EST 2007 x11vnc README file Date: Mon Jan 14 22:59:36 EST 2008
The following information is taken from these URLs: The following information is taken from these URLs:
@ -1978,8 +1978,8 @@ typedef unsigned int in_addr_t;
[361]http://www.archlinux.org/ Nokia 770 (.deb) [361]http://www.archlinux.org/ Nokia 770 (.deb)
[362]http://mike.saunby.googlepages.com/x11vncfornokia7702 Sharp [362]http://mike.saunby.googlepages.com/x11vncfornokia7702 Sharp
Zaurus [363]http://www.focv.com/ Debian: (.deb) Zaurus [363]http://www.focv.com/ Debian: (.deb)
[364]http://packages.debian.org/x11vnc (N.B: old and unmaintained; [364]http://packages.debian.org/x11vnc (N.B: often unmaintained; might
better to compile from source) Solaris: (pkg) be better to compile from source) Solaris: (pkg)
[365]http://www.sunfreeware.com/ (N.B: very old; better to compile [365]http://www.sunfreeware.com/ (N.B: very old; better to compile
from source) OpenBSD: (.tgz) [366]http://www.openbsd.org/ (N.B: very from source) OpenBSD: (.tgz) [366]http://www.openbsd.org/ (N.B: very
old and unmaintained; better to compile from source) old and unmaintained; better to compile from source)
@ -11842,7 +11842,7 @@ x11vnc: a VNC server for real X displays
Here are all of x11vnc command line options: Here are all of x11vnc command line options:
% x11vnc -opts (see below for -help long descriptions) % x11vnc -opts (see below for -help long descriptions)
x11vnc: allow VNC connections to real X11 displays. 0.9.4 lastmod: 2007-12-16 x11vnc: allow VNC connections to real X11 displays. 0.9.4 lastmod: 2008-01-14
x11vnc options: x11vnc options:
-display disp -auth file -N -display disp -auth file -N
@ -11910,24 +11910,24 @@ x11vnc options:
-allinput -speeds rd,bw,lat -wmdt string -allinput -speeds rd,bw,lat -wmdt string
-debug_pointer -debug_keyboard -defer time -debug_pointer -debug_keyboard -defer time
-wait time -wait_ui factor -nowait_bog -wait time -wait_ui factor -nowait_bog
-slow_fb time -xrefresh time -readtimeout n -slow_fb time -xrefresh time -nap
-nap -nonap -sb time -nonap -sb time -readtimeout n
-nofbpm -fbpm -nodpms -ping n -nofbpm -fbpm
-dpms -forcedpms -clientdpms -nodpms -dpms -forcedpms
-noserverdpms -noultraext -noxdamage -clientdpms -noserverdpms -noultraext
-xd_area A -xd_mem f -sigpipe string -noxdamage -xd_area A -xd_mem f
-threads -nothreads -fs f -sigpipe string -threads -nothreads
-gaps n -grow n -fuzz n -fs f -gaps n -grow n
-debug_tiles -snapfb -rawfb string -fuzz n -debug_tiles -snapfb
-freqtab file -pipeinput cmd -macnodim -rawfb string -freqtab file -pipeinput cmd
-macnosleep -macnosaver -macnowait -macnodim -macnosleep -macnosaver
-macwheel n -macnoswap -macnoresize -macnowait -macwheel n -macnoswap
-maciconanim n -macmenu -gui [gui-opts] -macnoresize -maciconanim n -macmenu
-remote command -query variable -QD variable -gui [gui-opts] -remote command -query variable
-sync -noremote -yesremote -QD variable -sync -noremote
-unsafe -safer -privremote -yesremote -unsafe -safer
-nocmds -allowedcmds list -deny_all -privremote -nocmds -allowedcmds list
-deny_all
libvncserver options: libvncserver options:
-rfbport port TCP port for RFB protocol -rfbport port TCP port for RFB protocol
@ -11961,7 +11961,7 @@ libvncserver-tight-extension options:
% x11vnc -help % x11vnc -help
x11vnc: allow VNC connections to real X11 displays. 0.9.4 lastmod: 2007-12-16 x11vnc: allow VNC connections to real X11 displays. 0.9.4 lastmod: 2008-01-14
(type "x11vnc -opts" to just list the options.) (type "x11vnc -opts" to just list the options.)
@ -14956,16 +14956,19 @@ t
to repaint themselves. Use this only if applications to repaint themselves. Use this only if applications
misbehave by not repainting themselves properly. misbehave by not repainting themselves properly.
See also -noxdamage. See also -noxdamage.
-readtimeout n Set libvncserver rfbMaxClientWait to n seconds. On
slow links that take a long time to paint the first
screen libvncserver may hit the timeout and drop the
connection. Default: 20 seconds.
-nap Monitor activity and if it is low take longer naps -nap Monitor activity and if it is low take longer naps
-nonap between screen polls to really cut down load when idle. -nonap between screen polls to really cut down load when idle.
Default: take naps Default: take naps
-sb time Time in seconds after NO activity (e.g. screen blank) -sb time Time in seconds after NO activity (e.g. screen blank)
to really throttle down the screen polls (i.e. sleep to really throttle down the screen polls (i.e. sleep
for about 1.5 secs). Use 0 to disable. Default: 60 for about 1.5 secs). Use 0 to disable. Default: 20
-readtimeout n Set libvncserver rfbMaxClientWait to n seconds. On
slow links that take a long time to paint the first
screen libvncserver may hit the timeout and drop the
connection. Default: 60 seconds.
-ping n Send a 1x1 framebuffer update to all clients every n
seconds (e.g. to try to keep a network connection alive)
-nofbpm If the system supports the FBPM (Frame Buffer Power -nofbpm If the system supports the FBPM (Frame Buffer Power
-fbpm Management) extension (i.e. some Sun systems), then -fbpm Management) extension (i.e. some Sun systems), then

@ -774,7 +774,7 @@ void print_help(int mode) {
" associated with it does apply as normal.\n" " associated with it does apply as normal.\n"
"\n" "\n"
" There are also some utilities for testing password\n" " There are also some utilities for testing password\n"
" if [list] starts with the \"%\" character. See the\n" " if [list] starts with the \"%%\" character. See the\n"
" quick_pw() function in the source for details.\n" " quick_pw() function in the source for details.\n"
"\n" "\n"
"-unixpw_nis [list] As -unixpw above, however do not use su(1) but rather\n" "-unixpw_nis [list] As -unixpw above, however do not use su(1) but rather\n"
@ -2214,14 +2214,6 @@ void print_help(int mode) {
" Keysym to the X server's keyboard mapping on an unused\n" " Keysym to the X server's keyboard mapping on an unused\n"
" key. Added Keysyms will be removed periodically and\n" " key. Added Keysyms will be removed periodically and\n"
" also when x11vnc exits. Default: %s\n" " also when x11vnc exits. Default: %s\n"
#if 0
"-xkbcompat Ignore the XKEYBOARD extension. Use as a workaround for\n"
" some keyboard mapping problems. E.g. if you are using\n"
" an international keyboard (AltGr or ISO_Level3_Shift),\n"
" and the OS or keyboard where the VNC viewer is run\n"
" is not identical to that of the X server, and you are\n"
" having problems typing some keys. Implies -nobell.\n"
#endif
"-clear_mods At startup and exit clear the modifier keys by sending\n" "-clear_mods At startup and exit clear the modifier keys by sending\n"
" KeyRelease for each one. The Lock modifiers are skipped.\n" " KeyRelease for each one. The Lock modifiers are skipped.\n"
" Used to clear the state if the display was accidentally\n" " Used to clear the state if the display was accidentally\n"
@ -3029,10 +3021,6 @@ void print_help(int mode) {
" to repaint themselves. Use this only if applications\n" " to repaint themselves. Use this only if applications\n"
" misbehave by not repainting themselves properly.\n" " misbehave by not repainting themselves properly.\n"
" See also -noxdamage.\n" " See also -noxdamage.\n"
"-readtimeout n Set libvncserver rfbMaxClientWait to n seconds. On\n"
" slow links that take a long time to paint the first\n"
" screen libvncserver may hit the timeout and drop the\n"
" connection. Default: %d seconds.\n"
"-nap Monitor activity and if it is low take longer naps\n" "-nap Monitor activity and if it is low take longer naps\n"
"-nonap between screen polls to really cut down load when idle.\n" "-nonap between screen polls to really cut down load when idle.\n"
" Default: %s\n" " Default: %s\n"
@ -3040,6 +3028,13 @@ void print_help(int mode) {
" to really throttle down the screen polls (i.e. sleep\n" " to really throttle down the screen polls (i.e. sleep\n"
" for about 1.5 secs). Use 0 to disable. Default: %d\n" " for about 1.5 secs). Use 0 to disable. Default: %d\n"
"\n" "\n"
"-readtimeout n Set libvncserver rfbMaxClientWait to n seconds. On\n"
" slow links that take a long time to paint the first\n"
" screen libvncserver may hit the timeout and drop the\n"
" connection. Default: %d seconds.\n"
"-ping n Send a 1x1 framebuffer update to all clients every n\n"
" seconds (e.g. to try to keep a network connection alive)\n"
"\n"
"-nofbpm If the system supports the FBPM (Frame Buffer Power\n" "-nofbpm If the system supports the FBPM (Frame Buffer Power\n"
"-fbpm Management) extension (i.e. some Sun systems), then\n" "-fbpm Management) extension (i.e. some Sun systems), then\n"
" prevent the video h/w from going into a reduced power\n" " prevent the video h/w from going into a reduced power\n"
@ -4277,6 +4272,7 @@ void print_help(int mode) {
fprintf(stderr, "\n"); fprintf(stderr, "\n");
exit(1); exit(1);
} }
#if 1
fprintf(stderr, help, lastmod, fprintf(stderr, help, lastmod,
POLL_8TO24_DELAY, POLL_8TO24_DELAY,
scaling_copyrect ? ":cr":":nocr", scaling_copyrect ? ":cr":":nocr",
@ -4306,8 +4302,8 @@ void print_help(int mode) {
defer_update, defer_update,
waitms, waitms,
wait_ui, wait_ui,
rfbMaxClientWait/1000,
take_naps ? "take naps":"no naps", take_naps ? "take naps":"no naps",
rfbMaxClientWait/1000,
screen_blank, screen_blank,
watch_fbpm ? "-nofbpm":"-fbpm", watch_fbpm ? "-nofbpm":"-fbpm",
watch_dpms ? "-nodpms":"-dpms", watch_dpms ? "-nodpms":"-dpms",
@ -4320,6 +4316,9 @@ void print_help(int mode) {
accept_remote_cmds ? "-yesremote":"-noremote", accept_remote_cmds ? "-yesremote":"-noremote",
"" ""
); );
#else
fprintf(stderr, "%s", help);
#endif
rfbUsage(); rfbUsage();
#endif #endif

@ -110,6 +110,7 @@ int inetd = 0; /* spawned from inetd(8) */
#endif #endif
int tightfilexfer = TIGHTFILEXFER; int tightfilexfer = TIGHTFILEXFER;
int first_conn_timeout = 0; /* -timeout */ int first_conn_timeout = 0; /* -timeout */
int ping_interval = 0; /* -ping */
int flash_cmap = 0; /* follow installed colormaps */ int flash_cmap = 0; /* follow installed colormaps */
int shift_cmap = 0; /* ncells < 256 and needs shift of pixel values */ int shift_cmap = 0; /* ncells < 256 and needs shift of pixel values */
int force_indexed_color = 0; /* whether to force indexed color for 8bpp */ int force_indexed_color = 0; /* whether to force indexed color for 8bpp */

@ -85,6 +85,7 @@ extern int begin_viewonly;
extern int inetd; extern int inetd;
extern int tightfilexfer; extern int tightfilexfer;
extern int first_conn_timeout; extern int first_conn_timeout;
extern int ping_interval;
extern int flash_cmap; extern int flash_cmap;
extern int shift_cmap; extern int shift_cmap;
extern int force_indexed_color; extern int force_indexed_color;

@ -1659,8 +1659,8 @@ static void mark_hint(hint_t hint) {
* devices are optimized for write, not read, so we are limited by the * devices are optimized for write, not read, so we are limited by the
* read bandwidth, sometimes only 5 MB/sec on otherwise fast hardware. * read bandwidth, sometimes only 5 MB/sec on otherwise fast hardware.
*/ */
static int *first_line = NULL, *last_line; static int *first_line = NULL, *last_line = NULL;
static unsigned short *left_diff, *right_diff; static unsigned short *left_diff = NULL, *right_diff = NULL;
static int copy_tiles(int tx, int ty, int nt) { static int copy_tiles(int tx, int ty, int nt) {
int x, y, line; int x, y, line;
@ -1670,14 +1670,23 @@ static int copy_tiles(int tx, int ty, int nt) {
int pixelsize = bpp/8; int pixelsize = bpp/8;
int first_min, last_max; int first_min, last_max;
int first_x = -1, last_x = -1; int first_x = -1, last_x = -1;
static int prev_ntiles_x = -1;
char *src, *dst, *s_src, *s_dst, *m_src, *m_dst; char *src, *dst, *s_src, *s_dst, *m_src, *m_dst;
char *h_src, *h_dst; char *h_src, *h_dst;
if (unixpw_in_progress) return 0; if (unixpw_in_progress) return 0;
if (! first_line) { if (ntiles_x != prev_ntiles_x && first_line != NULL) {
free(first_line); first_line = NULL;
free(last_line); last_line = NULL;
free(left_diff); left_diff = NULL;
free(right_diff); right_diff = NULL;
}
if (first_line == NULL) {
/* allocate arrays first time in. */ /* allocate arrays first time in. */
int n = ntiles_x + 1; int n = ntiles_x + 1;
rfbLog("copy_tiles: allocating first_line at size %d\n", n);
first_line = (int *) malloc((size_t) (n * sizeof(int))); first_line = (int *) malloc((size_t) (n * sizeof(int)));
last_line = (int *) malloc((size_t) (n * sizeof(int))); last_line = (int *) malloc((size_t) (n * sizeof(int)));
left_diff = (unsigned short *) left_diff = (unsigned short *)
@ -1685,6 +1694,7 @@ static int copy_tiles(int tx, int ty, int nt) {
right_diff = (unsigned short *) right_diff = (unsigned short *)
malloc((size_t) (n * sizeof(unsigned short))); malloc((size_t) (n * sizeof(unsigned short)));
} }
prev_ntiles_x = ntiles_x;
x = tx * tile_x; x = tx * tile_x;
y = ty * tile_y; y = ty * tile_y;
@ -3354,6 +3364,11 @@ if (tile_count) fprintf(stderr, "XX copytile: %.4f tile_count: %d\n", dnow() -
} else if (use_openssl && !tile_diffs) { } else if (use_openssl && !tile_diffs) {
ping_clients(0); ping_clients(0);
} }
/* -ping option: */
if (ping_interval) {
int td = ping_interval > 0 ? ping_interval : -ping_interval;
ping_clients(-td);
}
nap_check(tile_diffs); nap_check(tile_diffs);

@ -1,8 +1,8 @@
.\" This file was automatically generated from x11vnc -help output. .\" This file was automatically generated from x11vnc -help output.
.TH X11VNC "1" "December 2007" "x11vnc " "User Commands" .TH X11VNC "1" "January 2008" "x11vnc " "User Commands"
.SH NAME .SH NAME
x11vnc - allow VNC connections to real X11 displays x11vnc - allow VNC connections to real X11 displays
version: 0.9.4, lastmod: 2007-12-16 version: 0.9.4, lastmod: 2008-01-14
.SH SYNOPSIS .SH SYNOPSIS
.B x11vnc .B x11vnc
[OPTION]... [OPTION]...
@ -3546,13 +3546,6 @@ to repaint themselves. Use this only if applications
misbehave by not repainting themselves properly. misbehave by not repainting themselves properly.
See also \fB-noxdamage.\fR See also \fB-noxdamage.\fR
.PP .PP
\fB-readtimeout\fR \fIn\fR
.IP
Set libvncserver rfbMaxClientWait to n seconds. On
slow links that take a long time to paint the first
screen libvncserver may hit the timeout and drop the
connection. Default: 20 seconds.
.PP
\fB-nap,\fR \fB-nonap\fR \fB-nap,\fR \fB-nonap\fR
.IP .IP
Monitor activity and if it is low take longer naps Monitor activity and if it is low take longer naps
@ -3563,7 +3556,19 @@ Default: take naps
.IP .IP
Time in seconds after NO activity (e.g. screen blank) Time in seconds after NO activity (e.g. screen blank)
to really throttle down the screen polls (i.e. sleep to really throttle down the screen polls (i.e. sleep
for about 1.5 secs). Use 0 to disable. Default: 60 for about 1.5 secs). Use 0 to disable. Default: 20
.PP
\fB-readtimeout\fR \fIn\fR
.IP
Set libvncserver rfbMaxClientWait to n seconds. On
slow links that take a long time to paint the first
screen libvncserver may hit the timeout and drop the
connection. Default: 60 seconds.
.PP
\fB-ping\fR \fIn\fR
.IP
Send a 1x1 framebuffer update to all clients every n
seconds (e.g. to try to keep a network connection alive)
.PP .PP
\fB-nofbpm,\fR \fB-fbpm\fR \fB-nofbpm,\fR \fB-fbpm\fR
.IP .IP

@ -1873,6 +1873,7 @@ static void print_settings(int try_http, int bg, char *gui_str) {
fprintf(stderr, " shared: %d\n", shared); fprintf(stderr, " shared: %d\n", shared);
fprintf(stderr, " conn_once: %d\n", connect_once); fprintf(stderr, " conn_once: %d\n", connect_once);
fprintf(stderr, " timeout: %d\n", first_conn_timeout); fprintf(stderr, " timeout: %d\n", first_conn_timeout);
fprintf(stderr, " ping: %d\n", ping_interval);
fprintf(stderr, " inetd: %d\n", inetd); fprintf(stderr, " inetd: %d\n", inetd);
fprintf(stderr, " tightfilexfer: %d\n", tightfilexfer); fprintf(stderr, " tightfilexfer: %d\n", tightfilexfer);
fprintf(stderr, " http: %d\n", try_http); fprintf(stderr, " http: %d\n", try_http);
@ -2265,6 +2266,9 @@ char msg2[] =
if (raw_fb_str && !macosx_console) { if (raw_fb_str && !macosx_console) {
return; return;
} }
if (quiet) {
return;
}
if (nofb) { if (nofb) {
return; return;
} }
@ -3221,6 +3225,9 @@ int main(int argc, char* argv[]) {
} else if (!strcmp(arg, "-readtimeout")) { } else if (!strcmp(arg, "-readtimeout")) {
CHECK_ARGC CHECK_ARGC
rfbMaxClientWait = atoi(argv[++i]) * 1000; rfbMaxClientWait = atoi(argv[++i]) * 1000;
} else if (!strcmp(arg, "-ping")) {
CHECK_ARGC
ping_interval = atoi(argv[++i]);
} else if (!strcmp(arg, "-nap")) { } else if (!strcmp(arg, "-nap")) {
take_naps = 1; take_naps = 1;
} else if (!strcmp(arg, "-nonap")) { } else if (!strcmp(arg, "-nonap")) {

@ -15,7 +15,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0; int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */ /* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.9.4 lastmod: 2007-12-16"; char lastmod[] = "0.9.4 lastmod: 2008-01-14";
/* X display info */ /* X display info */

Loading…
Cancel
Save