bug:set sessionkey available when the sessionkey can be matched

Signed-off-by: song-chenxi050 <songchenxi2@huawei.com>
This commit is contained in:
song-chenxi050 2024-05-23 04:00:08 +00:00
parent e3bee959aa
commit 4ff07b29ec
2 changed files with 6 additions and 3 deletions

View File

@ -1807,6 +1807,8 @@ static void HandleConnectionData(
ReleaseAuthLock();
return;
}
int32_t index = (int32_t)SoftBusLtoHl(*(uint32_t *)data);
(void)SetSessionKeyAvailable(&auth->sessionKeyList, index);
auth->hasAuthPassed = true;
auth->lastActiveTime = GetCurrentTimeMs();
auth->connId[type] = connId;

View File

@ -237,8 +237,10 @@ int32_t SetSessionKeyAvailable(SessionKeyList *list, int32_t index)
if (item->index != index) {
continue;
}
item->isAvailable = true;
AUTH_LOGI(AUTH_FSM, "index=%{public}d, set available", index);
if (!item->isAvailable) {
item->isAvailable = true;
AUTH_LOGI(AUTH_FSM, "index=%{public}d, set available", index);
}
return SOFTBUS_OK;
}
AUTH_LOGE(AUTH_FSM, "can't find sessionKey, index=%{public}d", index);
@ -357,7 +359,6 @@ int32_t GetSessionKeyByIndex(const SessionKeyList *list, int32_t index, AuthLink
AUTH_LOGE(AUTH_FSM, "get session key fail, index=%{public}d", index);
return SOFTBUS_MEM_ERR;
}
item->isAvailable = true;
item->lastUseTime = GetCurrentTimeMs();
item->useTime[type] = item->lastUseTime;
AUTH_LOGI(AUTH_FSM, "get session key succ, index=%{public}d, time=%{public}" PRIu64, index, item->lastUseTime);