Commit 2625150b authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

Fixed bug where more than one loopbackdevicelink was created

parent 91949aca
......@@ -25,6 +25,7 @@
LoopbackLinkProvider::LoopbackLinkProvider()
: identityPackage(PACKAGE_TYPE_IDENTITY)
{
loopbackDeviceLink = 0;
NetworkPackage::createIdentityPackage(&identityPackage);
}
......@@ -36,18 +37,26 @@ LoopbackLinkProvider::~LoopbackLinkProvider()
void LoopbackLinkProvider::onNetworkChange(QNetworkSession::State state)
{
Q_UNUSED(state);
qDebug() << "Echo Device discovery emitted";
Q_EMIT onConnectionReceived(identityPackage, loopbackDeviceLink);
//qDebug() << "Echo Device discovery emitted";
LoopbackDeviceLink* newLoopbackDeviceLink = new LoopbackDeviceLink("loopback", this);
Q_EMIT onConnectionReceived(identityPackage, newLoopbackDeviceLink);
if (loopbackDeviceLink) {
delete loopbackDeviceLink;
}
loopbackDeviceLink = newLoopbackDeviceLink;
}
void LoopbackLinkProvider::onStart()
{
loopbackDeviceLink = new LoopbackDeviceLink("loopback", this);
onNetworkChange(QNetworkSession::Connected);
}
void LoopbackLinkProvider::onStop()
{
delete loopbackDeviceLink;
if (loopbackDeviceLink) {
delete loopbackDeviceLink;
}
}
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