aboutsummaryrefslogtreecommitdiff
path: root/singleapplication_p.h
diff options
context:
space:
mode:
authorNils Jeisecke <nils.jeisecke@saltation.com>2021-05-31 15:23:18 +0200
committerNils Jeisecke <nils.jeisecke@saltation.com>2021-05-31 16:12:32 +0200
commit0c458ec8c96d15f96947f1fe401654a903152a72 (patch)
tree4baf50476e034ba116dbc7819cbfbac7d59e4ed9 /singleapplication_p.h
parentMerge pull request #132 from itay-grudev/removed_incorrect_coment_in_basic_ex... (diff)
downloadsingleapplication-0c458ec8c96d15f96947f1fe401654a903152a72.tar.xz
Add simple acknowledge protocol to ensure the server has received all data
The server now acknowledges every received message by sending a \r. By waiting for the acknowledgement, clients should no longer terminate too early, causing bytes getting lost in Qt's internal socket handling. Message handling in the server is simplified because we can now rely on the readyRead signal being raised for every frame. This should finally solve #125 and #121. What remains is to correctly handle data sent using SingleApplication::sendMessage.
Diffstat (limited to 'singleapplication_p.h')
-rw-r--r--singleapplication_p.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/singleapplication_p.h b/singleapplication_p.h
index c49a46d..0777c33 100644
--- a/singleapplication_p.h
+++ b/singleapplication_p.h
@@ -81,6 +81,8 @@ public:
QString primaryUser() const;
void readInitMessageHeader(QLocalSocket *socket);
void readInitMessageBody(QLocalSocket *socket);
+ bool writeConfirmedMessage(int msecs, const QByteArray &msg);
+ void writeAck(QLocalSocket *sock);
static void randomSleep();
void addAppData(const QString &data);
QStringList appData() const;