Commit 9af0bc34 authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

LanDeviceLink now uses readLine instead of readAll

parent fc45b643
......@@ -81,16 +81,10 @@ bool LanDeviceLink::sendPackage(NetworkPackage& np)
void LanDeviceLink::dataReceived()
{
QByteArray data = mSocket->readAll();
//qDebug() << "LanDeviceLink dataReceived" << data;
QList<QByteArray> packages = data.split('\n');
Q_FOREACH(const QByteArray& package, packages) {
QByteArray package = mSocket->readLine();
if (package.length() < 3) {
continue;
}
//qDebug() << "LanDeviceLink dataReceived" << data;
NetworkPackage unserialized(QString::null);
NetworkPackage::unserialize(package, &unserialized);
......@@ -113,17 +107,12 @@ void LanDeviceLink::dataReceived()
if (unserialized.hasPayloadTransferInfo()) {
qWarning() << "Ignoring unencrypted payload";
continue;
}
Q_EMIT receivedPackage(unserialized);
}
}
//qDebug() << "MOAR BYTES" << mSocket->bytesAvailable() << packages.length();
if (mSocket->bytesAvailable() > 0) {
QMetaObject::invokeMethod(this, "dataReceived", Qt::QueuedConnection);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment