forked from loafle/openapi-generator-original
[C++] [Qt5] [Server] read json (#6343)
* [C++] [Qt5] [Server] [Bug] fixed Incomplete Read JSON Emit signal requestReceived only after request content is entirely received. * [C++] [Qt5] [Server] [Bug] fixed Incomplete Read JSON Emit signal requestReceived only after request content is entirely received.
This commit is contained in:
parent
d4b55d6767
commit
f8a144bdc1
@ -30,7 +30,16 @@ signals:
|
||||
protected:
|
||||
virtual void process(QHttpEngine::Socket *socket, const QString &path){
|
||||
Q_UNUSED(path);
|
||||
|
||||
// If the slot requires all data to be received, check to see if this is
|
||||
// already the case, otherwise, wait until the rest of it arrives
|
||||
if (socket->bytesAvailable() >= socket->contentLength()) {
|
||||
emit requestReceived(socket);
|
||||
} else {
|
||||
connect(socket, &Socket::readChannelFinished, [this, socket, m]() {
|
||||
emit requestReceived(socket);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -40,7 +40,16 @@ signals:
|
||||
protected:
|
||||
virtual void process(QHttpEngine::Socket *socket, const QString &path){
|
||||
Q_UNUSED(path);
|
||||
|
||||
// If the slot requires all data to be received, check to see if this is
|
||||
// already the case, otherwise, wait until the rest of it arrives
|
||||
if (socket->bytesAvailable() >= socket->contentLength()) {
|
||||
emit requestReceived(socket);
|
||||
} else {
|
||||
connect(socket, &Socket::readChannelFinished, [this, socket, m]() {
|
||||
emit requestReceived(socket);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user