!7971 fix:add check basicinfo when prosessbleonline

Merge pull request !7971 from 李志坚/master
This commit is contained in:
openharmony_ci 2024-10-10 13:28:03 +00:00 committed by Gitee
commit b0d5600b06
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 12 additions and 4 deletions

View File

@ -102,6 +102,7 @@ int32_t LnnSendDisconnectMsgToConnFsm(LnnConnectionFsm *connFsm);
int32_t LnnSendLeaveRequestToConnFsm(LnnConnectionFsm *connFsm);
int32_t LnnSendSyncOfflineFinishToConnFsm(LnnConnectionFsm *connFsm);
int32_t LnnSendNewNetworkOnlineToConnFsm(LnnConnectionFsm *connFsm);
bool CheckRemoteBasicInfoChanged(const NodeInfo *newNodeInfo);
#ifdef __cplusplus
#if __cplusplus

View File

@ -1169,7 +1169,7 @@ static bool IsSupportBrDupBle(uint32_t feature, AuthCapability capaBit)
return ((feature & (1 << (uint32_t)capaBit)) != 0);
}
static bool CheckBasicInfoChange(const NodeInfo *newNodeInfo)
bool CheckRemoteBasicInfoChanged(const NodeInfo *newNodeInfo)
{
if (newNodeInfo == NULL) {
return false;
@ -1195,7 +1195,7 @@ static void ProcessBleOnline(const LnnConntionInfo *connInfo)
}
if (LnnGetRemoteNodeInfoById(connInfo->nodeInfo->deviceInfo.deviceUdid, CATEGORY_UDID,
&remoteInfo) == SOFTBUS_OK && LnnHasDiscoveryType(&remoteInfo, DISCOVERY_TYPE_BLE) &&
!CheckBasicInfoChange(connInfo->nodeInfo)) {
!CheckRemoteBasicInfoChanged(connInfo->nodeInfo)) {
LNN_LOGI(LNN_BUILDER, "ble has online, no need to go online");
return;
}

View File

@ -238,7 +238,7 @@ int32_t TrySendJoinLNNRequest(const JoinLnnMsgPara *para, bool needReportFailure
DfxRecordLnnServerjoinStart(&para->addr, para->pkgName, needReportFailure);
isShort = para->isNeedConnect ? false : true;
LnnConnectionFsm *connFsm = FindConnectionFsmByAddr(&para->addr, isShort);
if (connFsm == NULL || connFsm->isDead) {
if (connFsm == NULL || connFsm->isDead || CheckRemoteBasicInfoChanged(para->dupInfo)) {
if (TryPendingJoinRequest(para, needReportFailure)) {
LNN_LOGI(LNN_BUILDER, "join request is pending, peerAddr=%{public}s", LnnPrintConnectionAddr(&para->addr));
FreeJoinLnnMsgPara(para);

View File

@ -166,7 +166,7 @@ int32_t PostJoinRequestToConnFsm(LnnConnectionFsm *connFsm, const JoinLnnMsgPara
if (connFsm == NULL) {
connFsm = FindConnectionFsmByAddr(&para->addr, false);
}
if (connFsm == NULL || connFsm->isDead) {
if (connFsm == NULL || connFsm->isDead || CheckRemoteBasicInfoChanged(para->dupInfo)) {
connFsm = StartNewConnectionFsm(&para->addr, para->pkgName, para->isNeedConnect);
if (connFsm != NULL) {
connFsm->connInfo.dupInfo = (para->dupInfo == NULL) ? NULL : DupNodeInfo(para->dupInfo);

View File

@ -199,6 +199,7 @@ public:
virtual bool IsSupportFeatureByCapaBit(uint32_t feature, AuthCapability capaBit) = 0;
virtual int32_t LnnGetRemoteNodeInfoByKey(const char *key, NodeInfo *info) = 0;
virtual void RegisterOOBEMonitor(void *p);
virtual bool CheckRemoteBasicInfoChanged(const NodeInfo *newNodeInfo);
virtual int32_t CheckAuthChannelIsExit(ConnectOption *connInfo);
};
class NetBuilderDepsInterfaceMock : public NetBuilderDepsInterface {
@ -341,6 +342,7 @@ public:
MOCK_METHOD1(CheckAuthChannelIsExit, int32_t (ConnectOption *connInfo));
static int32_t ActionOfLnnGetSettingDeviceName(char *deviceName, uint32_t len);
static int32_t ActionOfLnnGetAllOnlineNodeInfo(NodeBasicInfo **info, int32_t *infoNum);
MOCK_METHOD1(CheckRemoteBasicInfoChanged, bool (const NodeInfo *));
};
} // namespace OHOS
#endif // LNN_NET_BUILDER_DEPS_MOCK_H

View File

@ -722,6 +722,11 @@ void RegisterOOBEMonitor(void *p)
return GetNetBuilderDepsInterface()->RegisterOOBEMonitor(p);
}
bool CheckRemoteBasicInfoChanged(const NodeInfo *newNodeInfo)
{
return GetNetBuilderDepsInterface()->CheckRemoteBasicInfoChanged(newNodeInfo);
}
int32_t CheckAuthChannelIsExit(ConnectOption *connInfo)
{
return GetNetBuilderDepsInterface()->CheckAuthChannelIsExit(connInfo);