Merge PR #505: Retry the connection if the discovery finds more URLs for a host afte…

pull/507/head
Jenkins nymea 2021-01-14 00:38:22 +01:00
commit 5ad11f48df
2 changed files with 9 additions and 0 deletions

View File

@ -107,6 +107,7 @@ void NymeaConnection::setCurrentHost(NymeaHost *host)
transport->deleteLater();
}
if (m_currentHost) {
disconnect(m_currentHost, &NymeaHost::connectionChanged, this, &NymeaConnection::hostConnectionsUpdated);
m_currentHost = nullptr;
}
@ -121,6 +122,8 @@ void NymeaConnection::setCurrentHost(NymeaHost *host)
qDebug() << "Nymea host is" << m_currentHost->name() << m_currentHost->uuid();
connect(m_currentHost, &NymeaHost::connectionChanged, this, &NymeaConnection::hostConnectionsUpdated);
m_connectionStatus = ConnectionStatusConnecting;
emit connectionStatusChanged();
@ -394,6 +397,11 @@ void NymeaConnection::updateActiveBearers()
}
}
void NymeaConnection::hostConnectionsUpdated()
{
connectInternal(m_currentHost);
}
void NymeaConnection::registerTransport(NymeaTransportInterfaceFactory *transportFactory)
{
foreach (const QString &scheme, transportFactory->supportedSchemes()) {

View File

@ -120,6 +120,7 @@ private slots:
void onDisconnected();
void updateActiveBearers();
void hostConnectionsUpdated();
private:
void connectInternal(NymeaHost *host);
bool connectInternal(Connection *connection);