fix:it will core,when vpn connects failed.

bug link:http://172.17.50.104/biz/bug-view-91112.html
This commit is contained in:
renpeijia 2021-11-16 15:53:20 +08:00
parent 30d93af9ca
commit 4633f0fcbc
3 changed files with 40 additions and 14 deletions

View File

@ -74,6 +74,11 @@ KyConnectItem *KyActiveConnectResourse::getActiveConnectionByUuid(QString connec
}
QStringList interfaces = activeConnectPtr->devices();
if (interfaces.isEmpty()) {
qWarning()<< LOG_FLAG << "get active connection device failed.";
return nullptr;
}
QString ifaceUni = interfaces.at(0);
NetworkManager::Device:: Ptr devicePtr =
m_networkResourceInstance->findDeviceUni(ifaceUni);
@ -565,23 +570,28 @@ void KyActiveConnectResourse::getApActivateConnect(QList<KyApConnectItem *> &apC
QString KyActiveConnectResourse::getDeviceOfActivateConnect(QString conUuid)
{
QString deviceName = "";
QString deviceName = "";
NetworkManager::ActiveConnection::Ptr activeConnectPtr =
m_networkResourceInstance->getActiveConnect(conUuid);
NetworkManager::ActiveConnection::Ptr activeConnectPtr =
m_networkResourceInstance->getActiveConnect(conUuid);
if (nullptr == activeConnectPtr) {
qWarning()<< "[KyActiveConnectResourse]" <<"it can not find connect "<< conUuid;
return deviceName;
}
if (nullptr == activeConnectPtr) {
qWarning()<< "[KyActiveConnectResourse]" <<"it can not find connect "<< conUuid;
return deviceName;
}
QStringList interfaces = activeConnectPtr->devices();
QString ifaceUni = interfaces.at(0);
NetworkManager::Device:: Ptr devicePtr =
m_networkResourceInstance->findDeviceUni(ifaceUni);
deviceName = devicePtr->interfaceName();
QStringList interfaces = activeConnectPtr->devices();
if (interfaces.isEmpty()) {
qWarning()<< LOG_FLAG << "get device of active connection failed.";
return deviceName;
}
return deviceName;
QString ifaceUni = interfaces.at(0);
NetworkManager::Device:: Ptr devicePtr =
m_networkResourceInstance->findDeviceUni(ifaceUni);
deviceName = devicePtr->interfaceName();
return deviceName;
}
bool KyActiveConnectResourse::connectionIsVirtual(QString uuid)
@ -595,6 +605,11 @@ bool KyActiveConnectResourse::connectionIsVirtual(QString uuid)
}
QStringList interfaces = activeConnectPtr->devices();
if (interfaces.isEmpty()) {
qWarning()<< LOG_FLAG << "active connection get device failed.";
return false;
}
QString ifaceUni = interfaces.at(0);
NetworkManager::Device:: Ptr devicePtr =
m_networkResourceInstance->findDeviceUni(ifaceUni);

View File

@ -167,6 +167,11 @@ QString KyWirelessNetResource::getActiveConnectSsidByDevice(QString deviceName)
}
QStringList interfaces = activeConnectionPtr->devices();
if(interfaces.isEmpty()) {
qWarning()<< LOG_FLAG <<"get active device failed.";
continue;
}
QString ifaceUni = interfaces.at(0);
NetworkManager::Device:: Ptr devicePtr =
m_networkResourceInstance->findDeviceUni(ifaceUni);
@ -233,6 +238,10 @@ QString KyWirelessNetResource::getDeviceIFace(NetworkManager::ActiveConnection::
wirelessNetResourcessid = wireless_sett->ssid();
QStringList interfaces = actConn->devices();
if (interfaces.isEmpty()) {
return "";
}
QString ifaceUni = interfaces.at(0);
NetworkManager::Device:: Ptr devicePtr =
m_networkResourceInstance->findDeviceUni(ifaceUni);

View File

@ -968,12 +968,14 @@ void LanPage::updateConnectionProperty(KyConnectItem *p_connectItem)
}
}
} else {
} else if (!m_activeConnectionMap.contains(newUuid)){
if (p_connectItem->m_ifaceName == m_currentDeviceName
|| p_connectItem->m_ifaceName.isEmpty()) {
QListWidgetItem *p_listWidgetItem = insertNewItem(p_connectItem, m_inactivatedLanListWidget);
m_inactiveConnectionMap.insert(newUuid, p_listWidgetItem);
}
} else {
qWarning() << LOG_FLAG << newUuid <<" is in activemap, so not process.";
}
return;