[X2Go-Commits] [x2gokdrive] 01/01: Server to client selection in UDP mode.
git-admin at x2go.org
git-admin at x2go.org
Mon Dec 12 18:29:03 CET 2022
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch feature/udp-support
in repository x2gokdrive.
commit dfc732019e5d61a523c3e3c553d3a0ac6ae1decb
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date: Mon Dec 12 11:28:52 2022 -0600
Server to client selection in UDP mode.
---
x2gokdriveremote.c | 20 ++++++++++++++++++--
x2gokdriveremote.h | 3 ++-
x2gokdriveselection.c | 1 -
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/x2gokdriveremote.c b/x2gokdriveremote.c
index 0287a83..3d0f879 100644
--- a/x2gokdriveremote.c
+++ b/x2gokdriveremote.c
@@ -815,6 +815,7 @@ int send_selection_chunk(int sel, unsigned char* data, uint32_t length, uint32_t
int sent = 0;
int total = 0;
int hdr_sz=8*4;
+ uint32_t uncompressed_length=length;
//if the data is compressed, send "compressed" amount of bytes
// EPHYR_DBG("sending chunk. total %d, chunk %d, compressed %d", total, length, compressed);
@@ -837,7 +838,7 @@ int send_selection_chunk(int sel, unsigned char* data, uint32_t length, uint32_t
*((uint32_t*)buffer)=SELECTION; //0
*((uint32_t*)buffer+1)=sel; //4
*((uint32_t*)buffer+2)=format; //8
- *((uint32_t*)buffer+3)=length; //16
+ *((uint32_t*)buffer+3)=uncompressed_length; //16
*((uint32_t*)buffer+4)=first; //20
*((uint32_t*)buffer+5)=last; //24
*((uint32_t*)buffer+6)=compressed; //28
@@ -3343,6 +3344,16 @@ void open_socket(void)
EPHYR_DBG("Listen on port %d", remoteVars.listenPort);
remoteVars.address.sin_port = htons (remoteVars.listenPort);
}
+ if(!remoteVars.udpPort)
+ {
+ EPHYR_DBG("UDP port %d", DEFAULT_PORT+1);
+ remoteVars.udp_address.sin_port = htons (DEFAULT_PORT+1);
+ }
+ else
+ {
+ EPHYR_DBG("Listen on port %d", remoteVars.udpPort);
+ remoteVars.udp_address.sin_port = htons (remoteVars.udpPort);
+ }
if (bind ( remoteVars.serversock,
(struct sockaddr *) &remoteVars.address,
sizeof (remoteVars.address)) != 0)
@@ -3472,6 +3483,11 @@ void processConfigFileSetting(char* key, char* value)
sscanf(value, "%d",&remoteVars.listenPort);
EPHYR_DBG("listen %d", remoteVars.listenPort);
}
+ else if(!strcmp(key, "listen_udp"))
+ {
+ sscanf(value, "%d",&remoteVars.udpPort);
+ EPHYR_DBG("listen %d", remoteVars.udpPort);
+ }
else if(!strcmp(key, "clipboard"))
{
if(!strcmp(value,"client"))
@@ -3562,7 +3578,7 @@ remote_init(void)
EPHYR_DBG("JPEG quality is %d", remoteVars.initialJpegQuality);
remoteVars.compression=DEFAULT_COMPRESSION;
- remoteVars.selstruct.selectionMode = CLIP_NONE;
+ remoteVars.selstruct.selectionMode = CLIP_BOTH;
#warning change this defaults values
remoteVars.serverType=UDP;
diff --git a/x2gokdriveremote.h b/x2gokdriveremote.h
index fca85b0..ff57dab 100644
--- a/x2gokdriveremote.h
+++ b/x2gokdriveremote.h
@@ -469,6 +469,7 @@ struct _remoteHostVars
char displayName[256];
char initGeometry[128];
int listenPort;
+ int udpPort;
int jpegQuality, initialJpegQuality;
uint32_t framenum;
uint32_t framenum_sent;
@@ -555,7 +556,7 @@ struct _remoteHostVars
pthread_cond_t have_sendqueue_cond;
socklen_t addrlen;
- struct sockaddr_in address;
+ struct sockaddr_in address, udp_address;
BOOL client_connected;
BOOL client_initialized;
diff --git a/x2gokdriveselection.c b/x2gokdriveselection.c
index 8738c7c..793ed3a 100644
--- a/x2gokdriveselection.c
+++ b/x2gokdriveselection.c
@@ -767,7 +767,6 @@ void send_notify_to_client(xcb_atom_t selection, xcb_atom_t mime)
{
//creating the selection chunk with no data, which notifyes client that we have a selection
struct OutputChunk* chunk= malloc(sizeof(struct OutputChunk));
-// EPHYR_DBG("send selection notify to client");
memset((void*)chunk,0,sizeof(struct OutputChunk));
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdrive.git
More information about the x2go-commits
mailing list