diff options
author | runge <runge> | 2006-09-18 00:22:13 +0000 |
---|---|---|
committer | runge <runge> | 2006-09-18 00:22:13 +0000 |
commit | 3d00472a9c2878c4526311e2e820583a04e85817 (patch) | |
tree | 937a1b818e6a7495741054eb698ba8c34bcb135e /x11vnc/x11vnc.c | |
parent | 462c30db7d8e78a7ca6541ee20bf9fa59aca2e87 (diff) | |
download | libtdevnc-3d00472a9c2878c4526311e2e820583a04e85817.tar.gz libtdevnc-3d00472a9c2878c4526311e2e820583a04e85817.zip |
x11vnc: improve ultravnc filexfer rate by calling rfbCheckFD more often
Diffstat (limited to 'x11vnc/x11vnc.c')
-rw-r--r-- | x11vnc/x11vnc.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c index 0ca354e..b5e8b98 100644 --- a/x11vnc/x11vnc.c +++ b/x11vnc/x11vnc.c @@ -394,6 +394,47 @@ if (0 && dt > 0.0) fprintf(stderr, "dt: %.5f %.4f\n", dt, dnow() - x11vnc_start) return msec; } +void check_filexfer(void) { + static time_t last_check = 0; + rfbClientIteratorPtr iter; + rfbClientPtr cl; + int transferring = 0; + + if (time(NULL) <= last_check) { + return; + } + +#if 0 + if (getenv("NOFT")) { + return; + } +#endif + + iter = rfbGetClientIterator(screen); + while( (cl = rfbClientIteratorNext(iter)) ) { + if (cl->fileTransfer.receiving) { + transferring = 1; + break; + } + if (cl->fileTransfer.sending) { + transferring = 1; + break; + } + } + rfbReleaseClientIterator(iter); + + if (transferring) { + double start = dnow(); + while (dnow() < start + 0.5) { + rfbCFD(5000); + rfbCFD(1000); + rfbCFD(0); + } + } else { + last_check = time(NULL); + } +} + /* * main x11vnc loop: polls, checks for events, iterate libvncserver, etc. */ @@ -515,6 +556,7 @@ static void watch_loop(void) { check_xevents(0); check_autorepeat(); check_pm(); + check_filexfer(); check_keycode_state(); check_connect_inputs(); check_gui_inputs(); |