summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog17
-rw-r--r--configure.ac31
-rw-r--r--libvncclient/rfbproto.c4
-rw-r--r--libvncclient/tight.c3
-rw-r--r--libvncclient/vncviewer.c2
-rw-r--r--libvncserver/Makefile.am4
-rwxr-xr-xlibvncserver/auth.c2
-rw-r--r--libvncserver/main.c2
-rw-r--r--libvncserver/private.h4
-rw-r--r--libvncserver/rfbserver.c16
-rw-r--r--libvncserver/tightvnc-filetransfer/filelistinfo.h4
-rw-r--r--libvncserver/tightvnc-filetransfer/filetransfermsg.c2
-rw-r--r--libvncserver/tightvnc-filetransfer/handlefiletransferrequest.c2
-rw-r--r--libvncserver/tightvnc-filetransfer/rfbtightserver.c10
-rw-r--r--rfb/rfbclient.h2
-rw-r--r--rfb/rfbproto.h2
-rw-r--r--x11vnc/ChangeLog4
-rwxr-xr-xx11vnc/misc/x11vnc_pw24
-rw-r--r--x11vnc/x11vnc.c77
19 files changed, 177 insertions, 35 deletions
diff --git a/ChangeLog b/ChangeLog
index 3ac3af0..bb08857 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2005-11-25 Karl Runge <runge@karlrunge.com>
+ * configure.ac: disable tightvnc-filetransfer if no libpthread.
+ add --without-pthread option.
+ * libvncserver/Makefile.am: enable WITH_TIGHTVNC_FILETRANSFER
+ conditional.
+ * libvncserver/rfbserver.c: fix deadlock from
+ rfbReleaseExtensionIterator(), fix no libz/libjpeg builds.
+ * libvncserver/{main.c,private.h}, rfb/rfbclient.h, libvncclient/{rfbproto.c,
+ tight.c,vncviewer.c}: fix no libz/libjpeg builds.
+ * libvncserver/tightvnc-filetransfer/rfbtightserver.c: fix no
+ libz/libjpeg builds. rm // comments.
+ * libvncserver/tightvnc-filetransfer/filetransfermsg{.c,.h},
+ libvncserver/auth.c: rm // comments.
+ * libvncserver/tightvnc-filetransfer/filelistinfo.h: set NAME_MAX if not
+ defined.
+ * x11vnc: throttle load if fb update requests not taking place.
+
2005-10-22 Karl Runge <runge@karlrunge.com>
* x11vnc: -filexfer file transfer, -slow_fb, -blackout noptr...
diff --git a/configure.ac b/configure.ac
index 7f3ccad..abb338a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,10 +21,8 @@ AH_TEMPLATE(WITH_TIGHTVNC_FILETRANSFER, [Disable TightVNCFileTransfer protocol])
AC_ARG_WITH(tightvnc-filetransfer,
[ --without-filetransfer disable TightVNC file transfer protocol],
, [ with_tightvnc_filetransfer=yes ])
-if test "x$with_tightvnc_filetransfer" = "xyes"; then
- AC_DEFINE(WITH_TIGHTVNC_FILETRANSFER)
-fi
-AM_CONDITIONAL(WITH_TIGHTVNC_FILETRANSFER, test "$with_tightvnc_filetransfer" = "yes")
+# AC_DEFINE moved to after libpthread check.
+
AH_TEMPLATE(ALLOW24BPP, [Enable 24 bit per pixel in native framebuffer])
AC_ARG_WITH(24bpp,
[ --without-24bpp disable 24 bpp framebuffers],
@@ -271,14 +269,27 @@ libz may be obtained from: http://www.gzip.org/zlib/
fi
fi
-AC_CHECK_HEADER(pthread.h, HAVE_PTHREAD_H="true")
-if test ! -z "$HAVE_PTHREAD_H"; then
- # why twice?
- AC_CHECK_LIB(pthread, pthread_mutex_lock)
- AC_CHECK_LIB(pthread, pthread_mutex_lock, HAVE_LIBPTHREAD="true")
-fi
+AC_ARG_WITH(pthread,
+[ --without-pthread disable support for libpthread],,)
+if test "x$with_pthread" != "xno"; then
+ AC_CHECK_HEADER(pthread.h, HAVE_PTHREAD_H="true")
+ if test ! -z "$HAVE_PTHREAD_H"; then
+ AC_CHECK_LIB(pthread, pthread_mutex_lock)
+ AC_CHECK_LIB(pthread, pthread_mutex_lock, HAVE_LIBPTHREAD="true")
+ fi
+fi
AM_CONDITIONAL(HAVE_LIBPTHREAD, test ! -z "$HAVE_LIBPTHREAD")
+
+# tightvnc-filetransfer implemented using threads:
+if test -z "$HAVE_LIBPTHREAD"; then
+ with_tightvnc_filetransfer=""
+fi
+if test "x$with_tightvnc_filetransfer" = "xyes"; then
+ AC_DEFINE(WITH_TIGHTVNC_FILETRANSFER)
+fi
+AM_CONDITIONAL(WITH_TIGHTVNC_FILETRANSFER, test "$with_tightvnc_filetransfer" = "yes")
+
AM_CONDITIONAL(HAVE_LIBZ, test ! -z "$HAVE_ZLIB_H")
AM_CONDITIONAL(HAVE_LIBJPEG, test ! -z "$HAVE_JPEGLIB_H")
diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c
index 1a491a9..7f79c92 100644
--- a/libvncclient/rfbproto.c
+++ b/libvncclient/rfbproto.c
@@ -473,6 +473,7 @@ SetFormatAndEncodings(rfbClient* client)
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingRaw);
} else if (strncasecmp(encStr,"copyrect",encStrLen) == 0) {
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingCopyRect);
+#ifdef LIBVNCSERVER_HAVE_LIBZ
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
} else if (strncasecmp(encStr,"tight",encStrLen) == 0) {
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingTight);
@@ -482,6 +483,7 @@ SetFormatAndEncodings(rfbClient* client)
if (client->appData.enableJPEG)
requestQualityLevel = TRUE;
#endif
+#endif
} else if (strncasecmp(encStr,"hextile",encStrLen) == 0) {
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingHextile);
#ifdef LIBVNCSERVER_HAVE_LIBZ
@@ -547,9 +549,11 @@ SetFormatAndEncodings(rfbClient* client)
}
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingCopyRect);
+#ifdef LIBVNCSERVER_HAVE_LIBZ
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingTight);
#endif
+#endif
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingHextile);
#ifdef LIBVNCSERVER_HAVE_LIBZ
encs[se->nEncodings++] = rfbClientSwap32IfLE(rfbEncodingZlib);
diff --git a/libvncclient/tight.c b/libvncclient/tight.c
index 48a27e9..f9cc946 100644
--- a/libvncclient/tight.c
+++ b/libvncclient/tight.c
@@ -17,6 +17,7 @@
* USA.
*/
+#ifdef LIBVNCSERVER_HAVE_LIBZ
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
/*
@@ -681,5 +682,7 @@ JpegSetSrcManager(j_decompress_ptr cinfo,
#undef CARDBPP
+/* LIBVNCSERVER_HAVE_LIBZ and LIBVNCSERVER_HAVE_LIBJPEG */
+#endif
#endif
diff --git a/libvncclient/vncviewer.c b/libvncclient/vncviewer.c
index 607a2bb..31b4d3d 100644
--- a/libvncclient/vncviewer.c
+++ b/libvncclient/vncviewer.c
@@ -159,10 +159,12 @@ rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel,
client->decompStreamInited = FALSE;
#endif
+#ifdef LIBVNCSERVER_HAVE_LIBZ
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
memset(client->zlibStreamActive,0,sizeof(rfbBool)*4);
client->jpegSrcManager = NULL;
#endif
+#endif
client->HandleCursorPos = DummyPoint;
client->SoftCursorLockArea = DummyRect;
diff --git a/libvncserver/Makefile.am b/libvncserver/Makefile.am
index ecffba1..2a32666 100644
--- a/libvncserver/Makefile.am
+++ b/libvncserver/Makefile.am
@@ -1,6 +1,6 @@
AM_CFLAGS=-g -Wall
-#if WITH_TIGHTVNC_FILETRANSFER
+if WITH_TIGHTVNC_FILETRANSFER
TIGHTVNCFILETRANSFERHDRS=tightvnc-filetransfer/filelistinfo.h \
tightvnc-filetransfer/filetransfermsg.h \
tightvnc-filetransfer/handlefiletransferrequest.h \
@@ -10,7 +10,7 @@ TIGHTVNCFILETRANSFERSRCS = tightvnc-filetransfer/rfbtightserver.c \
tightvnc-filetransfer/handlefiletransferrequest.c \
tightvnc-filetransfer/filetransfermsg.c \
tightvnc-filetransfer/filelistinfo.c
-#endif
+endif
includedir=$(prefix)/include/rfb
#include_HEADERS=rfb.h rfbconfig.h rfbint.h rfbproto.h keysym.h rfbregion.h
diff --git a/libvncserver/auth.c b/libvncserver/auth.c
index 5c1c044..e3a89eb 100755
--- a/libvncserver/auth.c
+++ b/libvncserver/auth.c
@@ -179,7 +179,7 @@ rfbAuthNewClient(rfbClientPtr cl)
int32_t securityType = rfbSecTypeInvalid;
if (!cl->screen->authPasswdData || cl->reverseConnection) {
- // chk if this condition is valid or not.
+ /* chk if this condition is valid or not. */
securityType = rfbSecTypeNone;
} else if (cl->screen->authPasswdData) {
securityType = rfbSecTypeVncAuth;
diff --git a/libvncserver/main.c b/libvncserver/main.c
index e6908e1..e0c699f 100644
--- a/libvncserver/main.c
+++ b/libvncserver/main.c
@@ -840,9 +840,11 @@ void rfbScreenCleanup(rfbScreenInfoPtr screen)
TINI_MUTEX(screen->cursorMutex);
if(screen->cursor && screen->cursor->cleanup)
rfbFreeCursor(screen->cursor);
+#ifdef LIBVNCSERVER_HAVE_LIBZ
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
rfbTightCleanup(screen);
#endif
+#endif
free(screen);
}
diff --git a/libvncserver/private.h b/libvncserver/private.h
index 594512e..8865e81 100644
--- a/libvncserver/private.h
+++ b/libvncserver/private.h
@@ -13,7 +13,11 @@ rfbClientPtr rfbClientIteratorHead(rfbClientIteratorPtr i);
/* from tight.c */
+#ifdef LIBVNCSERVER_HAVE_LIBZ
+#ifdef LIBVNCSERVER_HAVE_LIBJPEG
extern void rfbTightCleanup(rfbScreenInfoPtr screen);
+#endif
+#endif
/* from zrle.c */
diff --git a/libvncserver/rfbserver.c b/libvncserver/rfbserver.c
index 474351c..75516fe 100644
--- a/libvncserver/rfbserver.c
+++ b/libvncserver/rfbserver.c
@@ -318,6 +318,7 @@ rfbNewTCPOrUDPClient(rfbScreenInfoPtr rfbScreen,
rfbScreen->clientHead = cl;
UNLOCK(rfbClientListMutex);
+#ifdef LIBVNCSERVER_HAVE_LIBZ
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
cl->tightCompressLevel = TIGHT_DEFAULT_COMPRESSION;
cl->tightQualityLevel = -1;
@@ -327,6 +328,7 @@ rfbNewTCPOrUDPClient(rfbScreenInfoPtr rfbScreen,
cl->zsActive[i] = FALSE;
}
#endif
+#endif
cl->enableCursorShapeUpdates = FALSE;
cl->enableCursorPosUpdates = FALSE;
@@ -562,7 +564,7 @@ rfbProcessClientProtocolVersion(rfbClientPtr cl)
return;
}
- // Chk for the minor version use either of the two standard version of RFB
+ /* Chk for the minor version use either of the two standard version of RFB */
cl->protocolMinorVersion = minor_;
if (minor_ > rfbProtocolMinorVersion) {
cl->protocolMinorVersion = rfbProtocolMinorVersion;
@@ -949,17 +951,16 @@ rfbProcessClientNormalMessage(rfbClientPtr cl)
}
encs++;
}
- rfbReleaseExtensionIterator();
-
if(e)
e = e->next;
}
+ rfbReleaseExtensionIterator();
if(!handled)
- rfbLog("rfbProcessClientNormalMessage: ignoring"
- " unknown encoding type %d\n",
- (int)enc);
+ rfbLog("rfbProcessClientNormalMessage: "
+ "ignoring unknown encoding type %d\n",
+ (int)enc);
}
}
}
@@ -1348,11 +1349,14 @@ rfbSendFramebufferUpdate(rfbClientPtr cl,
fu->type = rfbFramebufferUpdate;
if (nUpdateRegionRects != 0xFFFF) {
if(cl->screen->maxRectsPerUpdate>0
+#ifdef LIBVNCSERVER_HAVE_LIBZ
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
/* Tight encoding counts the rectangles differently */
&& cl->preferredEncoding != rfbEncodingTight
+ /* XXX Should rfbEncodingCoRRE be in here? */
&& cl->preferredEncoding != rfbEncodingCoRRE
#endif
+#endif
&& nUpdateRegionRects>cl->screen->maxRectsPerUpdate) {
sraRegion* newUpdateRegion = sraRgnBBox(updateRegion);
sraRgnDestroy(updateRegion);
diff --git a/libvncserver/tightvnc-filetransfer/filelistinfo.h b/libvncserver/tightvnc-filetransfer/filelistinfo.h
index 543edbe..a53964c 100644
--- a/libvncserver/tightvnc-filetransfer/filelistinfo.h
+++ b/libvncserver/tightvnc-filetransfer/filelistinfo.h
@@ -28,6 +28,10 @@
#include <limits.h>
+#if !defined(NAME_MAX)
+#define NAME_MAX 255
+#endif
+
#define SUCCESS 1
#define FAILURE 0
diff --git a/libvncserver/tightvnc-filetransfer/filetransfermsg.c b/libvncserver/tightvnc-filetransfer/filetransfermsg.c
index e7f6476..a51181f 100644
--- a/libvncserver/tightvnc-filetransfer/filetransfermsg.c
+++ b/libvncserver/tightvnc-filetransfer/filetransfermsg.c
@@ -292,7 +292,7 @@ GetFileDownloadLengthErrResponseMsg()
FileTransferMsg
GetFileDownloadResponseMsgInBlocks(rfbClientPtr cl, rfbTightClientPtr rtcp)
{
- //const unsigned int sz_rfbBlockSize = SZ_RFBBLOCKSIZE;
+ /* const unsigned int sz_rfbBlockSize = SZ_RFBBLOCKSIZE; */
int numOfBytesRead = 0;
char pBuf[SZ_RFBBLOCKSIZE];
char* path = rtcp->rcft.rcfd.fName;
diff --git a/libvncserver/tightvnc-filetransfer/handlefiletransferrequest.c b/libvncserver/tightvnc-filetransfer/handlefiletransferrequest.c
index d9165ef..9def149 100644
--- a/libvncserver/tightvnc-filetransfer/handlefiletransferrequest.c
+++ b/libvncserver/tightvnc-filetransfer/handlefiletransferrequest.c
@@ -984,5 +984,3 @@ HandleFileCreateDirRequest(rfbClientPtr cl, rfbTightClientPtr rtcp)
CreateDirectory(dirName);
}
-
-
diff --git a/libvncserver/tightvnc-filetransfer/rfbtightserver.c b/libvncserver/tightvnc-filetransfer/rfbtightserver.c
index 9d89de1..933025f 100644
--- a/libvncserver/tightvnc-filetransfer/rfbtightserver.c
+++ b/libvncserver/tightvnc-filetransfer/rfbtightserver.c
@@ -62,7 +62,7 @@ rfbVncAuthSendChallenge(cl)
rfbClientPtr cl;
{
- // 4 byte header is alreay sent. Which is rfbSecTypeVncAuth (same as rfbVncAuth). Just send the challenge.
+ /* 4 byte header is alreay sent. Which is rfbSecTypeVncAuth (same as rfbVncAuth). Just send the challenge. */
rfbRandomBytes(cl->authChallenge);
if (rfbWriteExact(cl, (char *)cl->authChallenge, CHALLENGESIZE) < 0) {
rfbLogPerror("rfbAuthNewClient: write");
@@ -165,7 +165,7 @@ rfbSendAuthCaps(cl)
return;
if (cl->screen->authPasswdData && !cl->reverseConnection) {
- // chk if this condition is valid or not.
+ /* chk if this condition is valid or not. */
SetCapInfo(&caplist[count], rfbAuthVNC, rfbStandardVendor);
rtcp->authCaps[count++] = rfbAuthVNC;
}
@@ -294,8 +294,10 @@ rfbSendInteractionCaps(cl)
SetCapInfo(&enc_list[i++], rfbEncodingRRE, rfbStandardVendor);
SetCapInfo(&enc_list[i++], rfbEncodingCoRRE, rfbStandardVendor);
SetCapInfo(&enc_list[i++], rfbEncodingHextile, rfbStandardVendor);
+#ifdef LIBVNCSERVER_HAVE_LIBZ
SetCapInfo(&enc_list[i++], rfbEncodingZlib, rfbTridiaVncVendor);
SetCapInfo(&enc_list[i++], rfbEncodingTight, rfbTightVncVendor);
+#endif
SetCapInfo(&enc_list[i++], rfbEncodingCompressLevel0, rfbTightVncVendor);
SetCapInfo(&enc_list[i++], rfbEncodingQualityLevel0, rfbTightVncVendor);
SetCapInfo(&enc_list[i++], rfbEncodingXCursor, rfbTightVncVendor);
@@ -404,7 +406,7 @@ const rfbClientToServerMsg* msg;
/*
- // We shouldn't close the connection here for unhandled msg, it should be left to libvncserver.
+ We shouldn't close the connection here for unhandled msg, it should be left to libvncserver.
rfbLog(" ... closing connection\n");
rfbCloseClient(cl);
@@ -466,7 +468,7 @@ rfbHandleSecTypeTight(rfbClientPtr cl) {
rfbTightClientPtr rtcp = (rfbTightClientPtr) malloc(sizeof(rfbTightClientRec));
if(rtcp == NULL) {
- // Error condition close socket
+ /* Error condition close socket */
rfbLog("Memory error has occured while handling Tight security type... closing connection.\n");
rfbCloseClient(cl);
return;
diff --git a/rfb/rfbclient.h b/rfb/rfbclient.h
index c99f4f9..8759b0e 100644
--- a/rfb/rfbclient.h
+++ b/rfb/rfbclient.h
@@ -157,6 +157,7 @@ typedef struct _rfbClient {
#endif
+#ifdef LIBVNCSERVER_HAVE_LIBZ
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
/*
* Variables for the ``tight'' encoding implementation.
@@ -184,6 +185,7 @@ typedef struct _rfbClient {
size_t jpegBufferLen;
#endif
+#endif
/* cursor.c */
diff --git a/rfb/rfbproto.h b/rfb/rfbproto.h
index 60ba763..cadbce4 100644
--- a/rfb/rfbproto.h
+++ b/rfb/rfbproto.h
@@ -905,7 +905,7 @@ typedef struct _rfbFileTransferMsg {
uint8_t contentType; /* See defines below */
uint16_t contentParam;/* Other possible content classification (Dir or File name, etc..) */
uint32_t size; /* FileSize or packet index or error or other */
- /* uint32_t sizeH; // Additional 32Bits params to handle big values. Only for V2 (we want backward compatibility between all V1 versions) */
+ /* uint32_t sizeH; Additional 32Bits params to handle big values. Only for V2 (we want backward compatibility between all V1 versions) */
uint32_t length;
/* followed by data char text[length] */
} rfbFileTransferMsg;
diff --git a/x11vnc/ChangeLog b/x11vnc/ChangeLog
index 752bd0e..1e3180f 100644
--- a/x11vnc/ChangeLog
+++ b/x11vnc/ChangeLog
@@ -1,3 +1,7 @@
+2005-11-25 Karl Runge <runge@karlrunge.com>
+ * x11vnc: throttle load if fb update requests not taking place.
+ * misc/x11vnc_pw: add utility script
+
2005-10-22 Karl Runge <runge@karlrunge.com>
* add tightVNC FileTransfer (-filexfer) and -DFILEXFER=1
* -slow_fb for special purpose infrequent polling.
diff --git a/x11vnc/misc/x11vnc_pw b/x11vnc/misc/x11vnc_pw
new file mode 100755
index 0000000..04ea1e3
--- /dev/null
+++ b/x11vnc/misc/x11vnc_pw
@@ -0,0 +1,24 @@
+#!/bin/sh
+# usage: x11vnc_pw [file] (default: ~/.vnc/passwd)
+
+if [ "X$1" = "X" ]; then
+ file=$HOME/.vnc/passwd
+else
+ file=$1
+fi
+
+stty -echo
+printf "Password: "
+read pw1; echo ""
+printf "Verify: "
+read pw2; echo ""
+stty echo
+
+if [ "X$pw1" != "X$pw2" ]; then
+ echo "passwords do not match."
+ exit 1
+fi
+
+x11vnc -help > /dev/null 2>&1
+x11vnc -storepasswd "$pw1" "$file"
+ls -l "$file"
diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c
index 5737a90..2fb2115 100644
--- a/x11vnc/x11vnc.c
+++ b/x11vnc/x11vnc.c
@@ -398,7 +398,7 @@ double xdamage_scheduled_mark = 0.0;
sraRegionPtr xdamage_scheduled_mark_region = NULL;
/* date +'lastmod: %Y-%m-%d' */
-char lastmod[] = "0.7.3 lastmod: 2005-10-22";
+char lastmod[] = "0.7.3 lastmod: 2005-11-25";
int hack_val = 0;
/* X display info */
@@ -520,6 +520,7 @@ unsigned char *tile_has_xdamage_diff, *tile_row_has_xdamage_diff;
/* times of recent events */
time_t last_event, last_input = 0, last_client = 0;
time_t last_keyboard_input = 0, last_pointer_input = 0;
+time_t last_fb_bytes_sent = 0;
double last_keyboard_time = 0.0;
double last_pointer_time = 0.0;
double last_pointer_click_time = 0.0;
@@ -591,6 +592,7 @@ void blackout_tiles(void);
void solid_bg(int);
void check_connect_inputs(void);
void check_gui_inputs(void);
+void record_last_fb_update(void);
void check_padded_fb(void);
void clean_up_exit(int);
void clear_modifiers(int init);
@@ -1120,6 +1122,7 @@ int got_deferupdate = 0;
int screen_blank = 60; /* number of seconds of no activity to throttle */
/* down the screen polls. zero to disable. */
+int no_fbu_blank = 30; /* nap if no client updates in this many secs. */
int take_naps = 1; /* -nap/-nonap */
int naptile = 4; /* tile change threshold per poll to take a nap */
int napfac = 4; /* time = napfac*waitms, cut load with extra waits */
@@ -20431,7 +20434,9 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
screen->setXCutText = xcut_receive;
if (filexfer) {
+#ifdef LIBVNCSERVER_WITH_TIGHTVNC_FILETRANSFER
rfbRegisterTightVNCFileTransferExtension();
+#endif
}
rfbInitServer(screen);
@@ -23504,6 +23509,7 @@ int copy_snap(void) {
*/
static void nap_set(int tile_cnt) {
int nap_in = nap_ok;
+ time_t now = time(0);
if (scan_count == 0) {
/* roll up check for all NSCAN scans */
@@ -23520,14 +23526,23 @@ static void nap_set(int tile_cnt) {
nap_ok = 0;
}
}
+ if (! nap_ok && client_count) {
+ if(now > last_fb_bytes_sent + no_fbu_blank) {
+ if (debug_tiles > 1) {
+ printf("nap_set: nap_ok=1: now: %d last: %d\n",
+ now, last_fb_bytes_sent);
+ }
+ nap_ok = 1;
+ }
+ }
if (show_cursor) {
/* kludge for the up to 4 tiles the mouse patch could occupy */
if ( tile_cnt > 4) {
- last_event = time(0);
+ last_event = now;
}
} else if (tile_cnt != 0) {
- last_event = time(0);
+ last_event = now;
}
}
@@ -23563,11 +23578,17 @@ static void nap_check(int tile_cnt) {
now = time(0);
if (screen_blank > 0) {
- int dt = (int) (now - last_event);
- int ms = 1500;
+ int dt_ev, dt_fbu, ms = 2000;
/* if no activity, pause here for a second or so. */
- if (dt > screen_blank) {
+ dt_ev = (int) (now - last_event);
+ dt_fbu = (int) (now - last_fb_bytes_sent);
+ if (dt_fbu > screen_blank) {
+ /* sleep longer for no fb requests */
+ nap_sleep(2 * ms, 16);
+ return;
+ }
+ if (dt_ev > screen_blank) {
nap_sleep(ms, 8);
return;
}
@@ -29756,6 +29777,45 @@ void rfbPE(long usec) {
}
}
+void record_last_fb_update(void) {
+ static int rbs0 = -1;
+ static time_t last_call = 0;
+ time_t now = time(0);
+ int rbs;
+ rfbClientIteratorPtr iter;
+ rfbClientPtr cl;
+
+ if (last_fb_bytes_sent == 0) {
+ last_fb_bytes_sent = now;
+ last_call = now;
+ }
+
+ if (now <= last_call + 1) {
+ /* check every second or so */
+ return;
+ }
+ last_call = now;
+
+ if (! screen) {
+ return;
+ }
+
+ iter = rfbGetClientIterator(screen);
+ while( (cl = rfbClientIteratorNext(iter)) ) {
+ rbs += cl->rawBytesEquivalent;
+ }
+ rfbReleaseClientIterator(iter);
+
+ if (rbs != rbs0) {
+ rbs0 = rbs;
+ if (debug_tiles > 1) {
+ printf("record_last_fb_update: %d %d\n", now,
+ last_fb_bytes_sent);
+ }
+ last_fb_bytes_sent = now;
+ }
+}
+
void rfbCFD(long usec) {
if (! screen) {
return;
@@ -29987,6 +30047,7 @@ if (debug_scroll) fprintf(stderr, "watch_loop: LOOP-BACK: %d\n", ret);
check_keycode_state();
check_connect_inputs();
check_gui_inputs();
+ record_last_fb_update();
check_padded_fb();
check_fixscreen();
check_xdamage_state();
@@ -30066,8 +30127,8 @@ if ((debug_tiles || debug_scroll > 1 || debug_wireframe > 1)
&& (tile_diffs > 4 || debug_tiles > 1)) {
double rate = (tile_x * tile_y * bpp/8 * tile_diffs) / dt;
fprintf(stderr, "============================= TILES: %d dt: %.4f"
- " t: %.4f %.2f MB/s\n", tile_diffs, dt, tm - x11vnc_start,
- rate/1000000.0);
+ " t: %.4f %.2f MB/s nap_ok: %d\n", tile_diffs, dt,
+ tm - x11vnc_start, rate/1000000.0, nap_ok);
}
}
OpenPOWER on IntegriCloud