fix: modify extra

Signed-off-by: liangjunhao <liangjunhao10@huawei.com>
This commit is contained in:
liangjunhao 2024-05-27 16:47:40 +08:00
parent 527d87ec55
commit 093c4b5003
9 changed files with 11 additions and 9 deletions

View File

@ -28,6 +28,7 @@ extern "C" {
#define MSG_FLAG_REQUEST 0
#define MES_FLAG_REPLY 1
#define TRAFFIC_LEN 32
#define UNKNOW_OS_TYPE 1 /* peer osType unknow */
typedef struct {
const char *sessionName;

View File

@ -442,7 +442,7 @@ static void OnRecvAuthChannelReply(int32_t authId, const char *data, int32_t len
.channelType = CHANNEL_TYPE_AUTH,
.authId = authId,
.linkType = info.connOpt.type,
.osType = info.appInfo.osType
.osType = (info.appInfo.osType < 0) ? UNKNOW_OS_TYPE : info.appInfo.osType,
};
TRANS_EVENT(EVENT_SCENE_OPEN_CHANNEL, EVENT_STAGE_HANDSHAKE_REPLY, extra);
int32_t ret = TransAuthChannelMsgUnpack(data, &info.appInfo, len);

View File

@ -507,7 +507,7 @@ static void TransAsyncOpenChannelProc(uint32_t laneHandle, SessionParam *param,
goto EXIT_ERR;
}
extra->peerUdid = appInfo->peerUdid;
extra->osType = appInfo->osType;
extra->osType = (appInfo->osType < 0) ? UNKNOW_OS_TYPE : appInfo->osType;
appInfo->connectType = connOpt.type;
extra->linkType = connOpt.type;
FillAppInfo(appInfo, param, &transInfo, connInnerInfo);

View File

@ -53,7 +53,7 @@ static int32_t TransServerOnChannelOpened(const char *pkgName, int32_t pid, cons
.result = EVENT_STAGE_RESULT_OK,
.callerPkg = pkgName,
.socketName = sessionName,
.osType = osType,
.osType = (osType < 0) ? UNKNOW_OS_TYPE : osType,
.peerUdid = peerUdid
};
CoreSessionState state = CORE_SESSION_STATE_INIT;

View File

@ -134,7 +134,7 @@ int32_t OnProxyChannelOpened(int32_t channelId, const AppInfo *appInfo, unsigned
.errcode = ret,
.result = (ret == SOFTBUS_OK) ? EVENT_STAGE_RESULT_OK : EVENT_STAGE_RESULT_FAILED
};
extra.osType = appInfo->osType;
extra.osType = (appInfo->osType < 0) ? UNKNOW_OS_TYPE : appInfo->osType;
extra.peerUdid = appInfo->peerUdid;
if (!isServer) {
extra.peerUdid = appInfo->appType == APP_TYPE_AUTH ? appInfo->peerData.deviceId : NULL;
@ -204,7 +204,7 @@ int32_t OnProxyChannelOpenFailed(int32_t channelId, const AppInfo *appInfo, int3
.callerPkg = appInfo->myData.pkgName,
.socketName = appInfo->myData.sessionName,
.peerUdid = appInfo->peerUdid,
.osType = appInfo->osType,
.osType = (appInfo->osType < 0) ? UNKNOW_OS_TYPE : appInfo->osType,
.result = EVENT_STAGE_RESULT_FAILED
};
TRANS_EVENT(EVENT_SCENE_OPEN_CHANNEL, EVENT_STAGE_OPEN_CHANNEL_END, extra);

View File

@ -52,7 +52,7 @@ static void OnSessionOpenFailProc(const SessionConn *node, int32_t errCode)
.linkType = node->appInfo.connectType,
.costTime = (int32_t)timeDiff,
.errcode = errCode,
.osType = node->appInfo.osType,
.osType = (node->appInfo.osType < 0) ? UNKNOW_OS_TYPE : node->appInfo.osType,
.peerUdid = node->appInfo.peerUdid,
.result = EVENT_STAGE_RESULT_FAILED
};

View File

@ -467,7 +467,7 @@ int32_t NotifyChannelOpenFailed(int32_t channelId, int32_t errCode)
.linkType = conn.appInfo.connectType,
.costTime = timediff,
.errcode = errCode,
.osType = conn.appInfo.osType,
.osType = (conn.appInfo.osType < 0) ? UNKNOW_OS_TYPE : (conn.appInfo.osType),
.peerUdid = conn.appInfo.peerUdid,
.result = EVENT_STAGE_RESULT_FAILED
};

View File

@ -190,7 +190,7 @@ int32_t NotifyUdpChannelOpenFailed(const AppInfo *info, int32_t errCode)
.linkType = info->connectType,
.costTime = timediff,
.errcode = errCode,
.osType = info->osType,
.osType = (info->osType < 0) ? UNKNOW_OS_TYPE : info->osType,
.peerUdid = info->peerUdid,
.result = EVENT_STAGE_RESULT_FAILED
};

View File

@ -27,6 +27,7 @@
#include "trans_log.h"
#define DFX_TIMERS_S 15
#define RETRY_GET_INFO_TIMES_MS 300
static IClientSessionCallBack g_sessionCb;
@ -273,7 +274,7 @@ NO_SANITIZE("cfi") int32_t TransOnSessionOpened(const char *sessionName, const C
} else {
ret = ClientEnableSessionByChannelId(channel, &sessionId);
if (ret == SOFTBUS_TRANS_SESSION_INFO_NOT_FOUND) {
SoftBusSleepMs(300); // avoid set channel info later than sesssion opened callback
SoftBusSleepMs(RETRY_GET_INFO_TIMES_MS); // avoid set channel info later than sesssion opened callback
ret = ClientEnableSessionByChannelId(channel, &sessionId);
}
}