[X2Go-Commits] [x2gokdriveclient] 01/01: Recieve udp data.
git-admin at x2go.org
git-admin at x2go.org
Thu Dec 22 22:50:57 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 x2gokdriveclient.
commit 10df5d2baf7255f215e07cf677cf3811b5657d23
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date: Thu Dec 22 15:50:45 2022 -0600
Recieve udp data.
---
client.cpp | 39 ++++++++++++++-------------------------
client.h | 1 +
displayarea.cpp | 2 +-
3 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/client.cpp b/client.cpp
index c42ddc9..319e322 100644
--- a/client.cpp
+++ b/client.cpp
@@ -234,7 +234,7 @@ Client::Client()
udpSocket=new QUdpSocket(this);
- connect(udpSocket, SIGNAL(readyRead()), this, SLOT(udpDataArrived()));
+ connect(udpSocket, SIGNAL(readyRead()), this, SLOT(UDPDataArrived()));
#ifndef Q_OS_LINUX
connect(QGuiApplication::clipboard(), SIGNAL(changed(QClipboard::Mode)), this, SLOT(slotSelectionChanged(QClipboard::Mode)));
@@ -402,9 +402,8 @@ void Client::slotDisconnect()
}
clientSocket->close();
-
-#warning close UDPSocket
- //((QUdpSocket*)clientSocket)->close();
+ if(udpSocket->isOpen())
+ udpSocket->close();
}
@@ -1771,13 +1770,12 @@ int Client::findPacket(QList< DgramPacket* >* list, uint16_t seq)
void Client::readDgram()
{
- QUdpSocket* socket=(QUdpSocket*)clientSocket;
- qint64 available=socket->pendingDatagramSize();
+ qint64 available=udpSocket->pendingDatagramSize();
// KDRStdErr()<<"Have available:"<<available<<KDR_ENDL;
QByteArray data;
data.resize(available);
- qint64 read=socket->readDatagram(data.data(),available);
+ qint64 read=udpSocket->readDatagram(data.data(),available);
if(read!=available)
{
KDRStdErr()<<"Read datagram failed, read "<<data.size()<<" from "<<available<<KDR_ENDL;
@@ -1896,15 +1894,17 @@ void Client::slotSynchronize()
sendEvent(evmsg);
}
+void Client::UDPDataArrived()
+{
+// KDRStdErr()<<"Got udp data"<<KDR_ENDL;
+ updateServerAlive();
+ while(((QUdpSocket*)udpSocket)->hasPendingDatagrams())
+ readDgram();
+}
+
+
void Client::dataArrived()
{
-#warning use for udp
-/* if(connectionType==UDP)
- {
- while(((QUdpSocket*)clientSocket)->hasPendingDatagrams())
- readDgram();
- return;
- }*/
updateServerAlive();
// KDRStdErr()<<"Have available:"<<clientSocket->bytesAvailable();
if(!bytesLeftToRead)
@@ -1986,11 +1986,6 @@ void Client::dataArrived()
if(clientSocket->bytesAvailable())
dataArrived();
-#warning use for udp
-/* {
- if(((QUdpSocket*)clientSocket)->bytesAvailable())
- dataArrived();
- }*/
}
@@ -2675,10 +2670,4 @@ void Client::openUdpConnection()
KDRStdErr(false)<<"UDP connection established"<<KDR_ENDL;
udpSocket->write((char*)tmp_cookie,8*4);
}
-
-// for(int i=0;i<8;++i)
-// {
-// KDRStdErr()<<"Cookie "<<i<<" - "<<tmp_cookie[i]<<KDR_ENDL;
-// }
-
}
diff --git a/client.h b/client.h
index 6ff2ef4..9752306 100644
--- a/client.h
+++ b/client.h
@@ -257,6 +257,7 @@ private slots:
void socketDisconnected();
void socketError(QAbstractSocket::SocketError socketError);
void dataArrived();
+ void UDPDataArrived();
void slotSynchronize();
void slotScreenAdded(QScreen* screen);
diff --git a/displayarea.cpp b/displayarea.cpp
index d60d7ed..b8586ab 100644
--- a/displayarea.cpp
+++ b/displayarea.cpp
@@ -78,7 +78,7 @@ LRESULT CALLBACK LowLevelKeyboardProc(
memcpy(evmsg,(char*)&etype,4);
memcpy(evmsg+4,(char*)&mods,4);
memcpy(evmsg+8,(char*)&key,4);
- display->client->sendEvent(evmsg,12);
+ display->client->sendEvent(evmsg);
return -1;
}
return CallNextHookEx(0, nCode, wParam, lParam);
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdriveclient.git
More information about the x2go-commits
mailing list