mirror of https://github.com/nymea/nymea.git
fix packet fragmentation on TCP layer
parent
6c28e51c1e
commit
69bf56af09
|
|
@ -32,6 +32,7 @@ tests/auto/devices/testdevices
|
|||
tests/auto/events/testevents
|
||||
tests/auto/jsonrpc/testjsonrpc
|
||||
tests/auto/logging/testlogging
|
||||
tests/auto/logging/testloggingdirect
|
||||
tests/auto/plugins/testactions
|
||||
tests/auto/restdeviceclasses/restdeviceclasses
|
||||
tests/auto/restdevices/restdevices
|
||||
|
|
|
|||
|
|
@ -221,8 +221,16 @@ void SslServer::onClientDisconnected()
|
|||
void SslServer::onSocketReadyRead()
|
||||
{
|
||||
QSslSocket *socket = static_cast<QSslSocket*>(sender());
|
||||
QByteArray data = socket->readAll();
|
||||
emit dataAvailable(socket, data);
|
||||
m_receiveBuffer.append(socket->readAll());
|
||||
int splitIndex = m_receiveBuffer.indexOf("}\n{");
|
||||
while (splitIndex > -1) {
|
||||
emit dataAvailable(socket, m_receiveBuffer.left(splitIndex + 1));
|
||||
m_receiveBuffer = m_receiveBuffer.right(m_receiveBuffer.length() - splitIndex - 2);
|
||||
splitIndex = m_receiveBuffer.indexOf("}\n{");
|
||||
}
|
||||
if (m_receiveBuffer.endsWith("}\n")) {
|
||||
emit dataAvailable(socket, m_receiveBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ private slots:
|
|||
private:
|
||||
bool m_sslEnabled = false;
|
||||
QSslConfiguration m_config;
|
||||
QByteArray m_receiveBuffer;
|
||||
};
|
||||
|
||||
class TcpServer : public TransportInterface
|
||||
|
|
|
|||
Loading…
Reference in New Issue