summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Beier <dontmind@freeshell.org>2018-10-21 23:59:39 +0200
committerChristian Beier <dontmind@freeshell.org>2018-10-21 23:59:39 +0200
commit73cb96fec028a576a5a24417b57723b55854ad7b (patch)
tree51112f9968fad4abd23bac4e1fe287a759d4c853
parentf8912fee5a58fb3975eda2589f6d4686f0c1ae68 (diff)
downloadlibtdevnc-73cb96fec028a576a5a24417b57723b55854ad7b.tar.gz
libtdevnc-73cb96fec028a576a5a24417b57723b55854ad7b.zip
tightvnc-filetransfer: wait for download thread end in CloseUndoneFileDownload()
...and use it when deregistering the file transfer extension. Closes #242
-rw-r--r--libvncserver/tightvnc-filetransfer/filetransfermsg.c2
-rw-r--r--libvncserver/tightvnc-filetransfer/rfbtightserver.c7
2 files changed, 7 insertions, 2 deletions
diff --git a/libvncserver/tightvnc-filetransfer/filetransfermsg.c b/libvncserver/tightvnc-filetransfer/filetransfermsg.c
index f674b92..0003b11 100644
--- a/libvncserver/tightvnc-filetransfer/filetransfermsg.c
+++ b/libvncserver/tightvnc-filetransfer/filetransfermsg.c
@@ -770,6 +770,8 @@ CloseUndoneFileDownload(rfbClientPtr cl, rfbTightClientPtr rtcp)
if(rtcp->rcft.rcfd.downloadInProgress == TRUE) {
rtcp->rcft.rcfd.downloadInProgress = FALSE;
+ /* the thread will return if downloadInProgress is FALSE */
+ pthread_join(rtcp->rcft.rcfd.downloadThread, NULL);
if(rtcp->rcft.rcfd.downloadFD != -1) {
close(rtcp->rcft.rcfd.downloadFD);
diff --git a/libvncserver/tightvnc-filetransfer/rfbtightserver.c b/libvncserver/tightvnc-filetransfer/rfbtightserver.c
index 67d4cb5..651d8fb 100644
--- a/libvncserver/tightvnc-filetransfer/rfbtightserver.c
+++ b/libvncserver/tightvnc-filetransfer/rfbtightserver.c
@@ -26,6 +26,7 @@
#include <rfb/rfb.h>
#include "rfbtightproto.h"
#include "handlefiletransferrequest.h"
+#include "filetransfermsg.h"
/*
* Get my data!
@@ -448,9 +449,11 @@ rfbTightExtensionMsgHandler(struct _rfbClientRec* cl, void* data,
void
rfbTightExtensionClientClose(rfbClientPtr cl, void* data) {
- if(data != NULL)
+ if(data != NULL) {
+ CloseUndoneFileUpload(cl, data);
+ CloseUndoneFileDownload(cl, data);
free(data);
-
+ }
}
void