diff options
author | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-02-16 10:20:07 +0100 |
---|---|---|
committer | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-02-20 10:22:31 +0000 |
commit | df667f7560f2625d7278935a18bf12b47f76d4d3 (patch) | |
tree | 968b3216de517fa363f5d22166a0de462d90e374 /src/libs/installer/remoteserverconnection.h | |
parent | d6bca86cad962a0078c2a8111133cff123f1ba0a (diff) |
Fix handling of incomplete messages in client/server communication
Do not assume that the socket always contains enough data. Instead,
prefix every 'packet' with its size, and back off until the full
packet is available.
The actual encoding/decoding is done in Protocol::sendPacket,
Protocol::receivePacket. To be able to use the methods everywhere,
replies are now prefixed by a Protocol::Reply command.
Change-Id: I75a89605b2cc3fe2f2f841d8e3159fc8aea65d77
Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
Diffstat (limited to 'src/libs/installer/remoteserverconnection.h')
-rw-r--r-- | src/libs/installer/remoteserverconnection.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libs/installer/remoteserverconnection.h b/src/libs/installer/remoteserverconnection.h index 53a7d1f6c..1d49def91 100644 --- a/src/libs/installer/remoteserverconnection.h +++ b/src/libs/installer/remoteserverconnection.h @@ -42,6 +42,7 @@ QT_BEGIN_NAMESPACE class QProcess; +class QIODevice; QT_END_NAMESPACE namespace QInstaller { @@ -66,11 +67,11 @@ signals: private: template <typename T> - void sendData(QDataStream &stream, const T &arg); - void handleQProcess(const QString &command, QDataStream &receivedStream); - void handleQSettings(const QString &command, QDataStream &receivedStream, + void sendData(QIODevice *device, const T &arg); + void handleQProcess(QIODevice *device, const QString &command, QDataStream &data); + void handleQSettings(QIODevice *device, const QString &command, QDataStream &data, PermissionSettings *settings); - void handleQFSFileEngine(const QString &command, QDataStream &receivedStream); + void handleQFSFileEngine(QIODevice *device, const QString &command, QDataStream &data); private: qintptr m_socketDescriptor; |