!8076 细化认证超时错误码

Merge pull request !8076 from chenbotong/master
This commit is contained in:
openharmony_ci 2024-10-17 14:31:55 +00:00 committed by Gitee
commit 253a207a25
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 30 additions and 2 deletions

View File

@ -471,6 +471,21 @@ static AuthFsm *GetAuthFsmByConnInfo(const AuthConnInfo *connInfo, bool isServer
return NULL;
}
static void ProcessTimeoutErrorCode(AuthFsm *authFsm, int32_t *result)
{
AuthFsmStateIndex curState = authFsm->curState;
if (curState == STATE_SYNC_NEGOTIATION || curState == STATE_SYNC_DEVICE_ID) {
*result = SOFTBUS_AUTH_SYNC_DEVICEID_TIMEOUT;
} else if (curState == STATE_DEVICE_AUTH) {
*result = (authFsm->info.normalizedType == NORMALIZED_SUPPORT || authFsm->info.isSupportFastAuth) ?
SOFTBUS_AUTH_SAVE_SESSIONKEY_TIMEOUT : SOFTBUS_AUTH_HICHAIN_TIMEOUT;
} else if (curState == STATE_SYNC_DEVICE_INFO) {
*result = SOFTBUS_AUTH_SYNC_DEVICEINFO_TIMEOUT;
} else {
AUTH_LOGE(AUTH_FSM, "authFsm state error, curState=%{public}d", curState);
}
}
static void CompleteAuthSession(AuthFsm *authFsm, int32_t result)
{
SoftbusHitraceStart(SOFTBUS_HITRACE_ID_VALID, (uint64_t)authFsm->authSeq);
@ -500,6 +515,9 @@ static void CompleteAuthSession(AuthFsm *authFsm, int32_t result)
}
}
} else {
if (result == SOFTBUS_AUTH_TIMEOUT) {
ProcessTimeoutErrorCode(authFsm, &result);
}
LnnFsmRemoveMessage(&authFsm->fsm, FSM_MSG_AUTH_TIMEOUT);
if (!authFsm->info.isServer) {
NotifyNormalizeRequestFail(authFsm->authSeq, result);

View File

@ -1249,6 +1249,10 @@ int32_t LnnTriggerDataLevelHeartbeat(void)
int32_t LnnTriggerDirectHeartbeat(const char *networkId, uint64_t timeout)
{
LNN_LOGD(LNN_HEART_BEAT, "LnnTriggerDirectHeartbeat");
if (networkId == NULL) {
LNN_LOGE(LNN_HEART_BEAT, "networkId is null");
return SOFTBUS_INVALID_PARAM;
}
int32_t ret = LnnStartHbByTypeAndStrategyDirectly(HEARTBEAT_TYPE_BLE_V0, STRATEGY_HB_SEND_DIRECT,
false, networkId, timeout);
if (ret != SOFTBUS_OK) {

View File

@ -165,7 +165,7 @@ static SoftBusMutex g_rawLinkLock;
#define INVALID_P2P_REQUEST_ID (-1)
#define LANE_REQ_ID_TYPE_SHIFT 28
#define SHORT_RANGE_PTK_NOT_MATCH_CODE 4
#define BLE_TRIGGER_TIMEOUT 3000
#define BLE_TRIGGER_TIMEOUT 5000
#define SOFTBUS_LNN_PTK_NOT_MATCH (SOFTBUS_ERRNO(SHORT_DISTANCE_MAPPING_MODULE_CODE) + SHORT_RANGE_PTK_NOT_MATCH_CODE)
#define RAW_LINK_CHECK_DELAY (200)
#define RAW_LINK_CHECK_NUM (10)
@ -1347,7 +1347,8 @@ static void OnWifiDirectConnectFailure(uint32_t p2pRequestId, int32_t reason)
HandleGuideChannelAsyncFail(ASYNC_RESULT_P2P, p2pRequestId, reason);
return;
}
if (reason == SOFTBUS_CONN_CONNECT_GROUP_TIMEOUT || reason == SOFTBUS_CONN_HV2_BLE_TRIGGER_TIMEOUT) {
if (reason == SOFTBUS_CONN_HV3_WAIT_CONNECTION_TIMEOUT ||
reason == SOFTBUS_CONN_HV2_BLE_TRIGGER_TIMEOUT) {
HandleActionTriggerError(p2pRequestId);
}
LinkConflictType conflictType = GetConflictTypeWithErrcode(reason);

View File

@ -475,6 +475,10 @@ enum SoftBusErrNo {
SOFTBUS_CHANNEL_AUTH_PACK_DATA_FAIL,
SOFTBUS_CHANNEL_AUTH_UNPACK_DATA_FAIL,
SOFTBUS_CHANNEL_AUTH_GET_INSTANCE_FAIL,
SOFTBUS_AUTH_SYNC_DEVICEID_TIMEOUT,
SOFTBUS_AUTH_HICHAIN_TIMEOUT,
SOFTBUS_AUTH_SAVE_SESSIONKEY_TIMEOUT,
SOFTBUS_AUTH_SYNC_DEVICEINFO_TIMEOUT,
/* errno begin: -((203 << 21) | (4 << 16) | 0xFFFF) */
SOFTBUS_NETWORK_ERR_BASE = SOFTBUS_ERRNO(LNN_SUB_MODULE_CODE),

View File

@ -351,6 +351,7 @@ HWTEST_F(AuthSessionFsmTest, RECOVERY_NORMALIZED_DEVICE_KEY_TEST_001, TestSize.L
authFsm->info.normalizedKey = (SessionKey *)SoftBusMalloc(sizeof(SessionKey));
if (authFsm->info.normalizedKey == nullptr) {
SoftBusFree(authFsm);
return;
}
ret = RecoveryNormalizedDeviceKey(authFsm);
EXPECT_TRUE(ret == SOFTBUS_INVALID_PARAM);