fix packet fragmentation on TCP layer
This commit is contained in:
parent
6c28e51c1e
commit
69bf56af09
1
.gitignore
vendored
1
.gitignore
vendored
@ -32,6 +32,7 @@ tests/auto/devices/testdevices
|
|||||||
tests/auto/events/testevents
|
tests/auto/events/testevents
|
||||||
tests/auto/jsonrpc/testjsonrpc
|
tests/auto/jsonrpc/testjsonrpc
|
||||||
tests/auto/logging/testlogging
|
tests/auto/logging/testlogging
|
||||||
|
tests/auto/logging/testloggingdirect
|
||||||
tests/auto/plugins/testactions
|
tests/auto/plugins/testactions
|
||||||
tests/auto/restdeviceclasses/restdeviceclasses
|
tests/auto/restdeviceclasses/restdeviceclasses
|
||||||
tests/auto/restdevices/restdevices
|
tests/auto/restdevices/restdevices
|
||||||
|
|||||||
@ -221,8 +221,16 @@ void SslServer::onClientDisconnected()
|
|||||||
void SslServer::onSocketReadyRead()
|
void SslServer::onSocketReadyRead()
|
||||||
{
|
{
|
||||||
QSslSocket *socket = static_cast<QSslSocket*>(sender());
|
QSslSocket *socket = static_cast<QSslSocket*>(sender());
|
||||||
QByteArray data = socket->readAll();
|
m_receiveBuffer.append(socket->readAll());
|
||||||
emit dataAvailable(socket, data);
|
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:
|
private:
|
||||||
bool m_sslEnabled = false;
|
bool m_sslEnabled = false;
|
||||||
QSslConfiguration m_config;
|
QSslConfiguration m_config;
|
||||||
|
QByteArray m_receiveBuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TcpServer : public TransportInterface
|
class TcpServer : public TransportInterface
|
||||||
|
|||||||
Reference in New Issue
Block a user