mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-11-27 02:40:40 +00:00
fix: buscenter event info add requestId
Signed-off-by: qinhao <qinhao43@huawei.com>
This commit is contained in:
parent
ef306f962a
commit
d899fceeaf
@ -756,16 +756,6 @@ static int32_t RetryRegTrustDataChangeListener()
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
|
||||
static void DfxRecordLnnAuthStart(const AuthConnInfo *connInfo)
|
||||
{
|
||||
LnnEventExtra extra = { 0 };
|
||||
LnnEventExtraInit(&extra);
|
||||
if (connInfo != NULL) {
|
||||
extra.authLinkType = connInfo->type;
|
||||
}
|
||||
LNN_EVENT(EVENT_SCENE_JOIN_LNN, EVENT_STAGE_AUTH, extra);
|
||||
}
|
||||
|
||||
static int32_t StartVerifyDevice(uint32_t requestId, const AuthConnInfo *connInfo, const AuthVerifyCallback *verifyCb,
|
||||
const AuthConnCallback *connCb, bool isFastAuth)
|
||||
{
|
||||
@ -1117,10 +1107,11 @@ static int32_t GetUdidShortHash(const AuthConnInfo *connInfo, char *udidBuf, uin
|
||||
}
|
||||
|
||||
|
||||
static void DfxRecordLnnConnectEnd(uint64_t connId, const AuthConnInfo *connInfo, int32_t reason)
|
||||
static void DfxRecordLnnConnectEnd(uint32_t requestId, uint64_t connId, const AuthConnInfo *connInfo, int32_t reason)
|
||||
{
|
||||
LnnEventExtra extra = { 0 };
|
||||
LnnEventExtraInit(&extra);
|
||||
extra.authRequestId = (int32_t)requestId;
|
||||
extra.connectionId = (int32_t)connId;
|
||||
extra.errcode = reason;
|
||||
extra.result = (reason == SOFTBUS_OK) ? EVENT_STAGE_RESULT_OK : EVENT_STAGE_RESULT_FAILED;
|
||||
@ -1165,7 +1156,7 @@ static uint32_t AddConcurrentAuthRequest(const AuthConnInfo *connInfo, AuthReque
|
||||
|
||||
static void OnConnectResult(uint32_t requestId, uint64_t connId, int32_t result, const AuthConnInfo *connInfo)
|
||||
{
|
||||
DfxRecordLnnConnectEnd(connId, connInfo, result);
|
||||
DfxRecordLnnConnectEnd(requestId, connId, connInfo, result);
|
||||
AUTH_LOGI(AUTH_CONN, "OnConnectResult: requestId=%{public}u, result=%{public}d", requestId, result);
|
||||
AuthRequest request;
|
||||
if (GetAuthRequest(requestId, &request) != SOFTBUS_OK) {
|
||||
@ -1507,7 +1498,6 @@ uint32_t AuthGenRequestId(void)
|
||||
int32_t AuthStartVerify(const AuthConnInfo *connInfo, uint32_t requestId,
|
||||
const AuthVerifyCallback *callback, bool isFastAuth)
|
||||
{
|
||||
DfxRecordLnnAuthStart(connInfo);
|
||||
if (connInfo == NULL || !CheckVerifyCallback(callback)) {
|
||||
AUTH_LOGE(AUTH_CONN, "invalid param");
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
|
@ -323,6 +323,7 @@ static void DfxRecordLnnAuthEnd(AuthFsm *authFsm, uint64_t costTime, int32_t rea
|
||||
if (authFsm != NULL) {
|
||||
extra.authLinkType = authFsm->info.connInfo.type;
|
||||
extra.authId = (int32_t)authFsm->authSeq;
|
||||
extra.authRequestId = (int32_t)authFsm->info.requestId;
|
||||
}
|
||||
LNN_EVENT(EVENT_SCENE_JOIN_LNN, EVENT_STAGE_AUTH, extra);
|
||||
}
|
||||
|
@ -1850,17 +1850,20 @@ static int32_t PostDeviceIdNew(int64_t authSeq, const AuthSessionInfo *info)
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
static void DfxRecordLnnPostDeviceIdStart(int64_t authSeq)
|
||||
static void DfxRecordLnnPostDeviceIdStart(int64_t authSeq, const AuthSessionInfo *info)
|
||||
{
|
||||
LnnEventExtra extra = { 0 };
|
||||
LnnEventExtraInit(&extra);
|
||||
extra.authId = (int32_t)authSeq;
|
||||
if (info != NULL) {
|
||||
extra.authRequestId = (int32_t)info->requestId;
|
||||
}
|
||||
LNN_EVENT(EVENT_SCENE_JOIN_LNN, EVENT_STAGE_AUTH_DEVICE_ID_POST, extra);
|
||||
}
|
||||
|
||||
int32_t PostDeviceIdMessage(int64_t authSeq, const AuthSessionInfo *info)
|
||||
{
|
||||
DfxRecordLnnPostDeviceIdStart(authSeq);
|
||||
DfxRecordLnnPostDeviceIdStart(authSeq, info);
|
||||
AUTH_CHECK_AND_RETURN_RET_LOGE(info != NULL, SOFTBUS_INVALID_PARAM, AUTH_FSM, "info is NULL");
|
||||
if (info->version == SOFTBUS_OLD_V1) {
|
||||
return PostDeviceIdV1(authSeq, info);
|
||||
@ -1896,17 +1899,20 @@ static void GetSessionKeyList(int64_t authSeq, const AuthSessionInfo *info, Sess
|
||||
(void)memset_s(&sessionKey, sizeof(SessionKey), 0, sizeof(SessionKey));
|
||||
}
|
||||
|
||||
static void DfxRecordLnnPostDeviceInfoStart(int64_t authSeq)
|
||||
static void DfxRecordLnnPostDeviceInfoStart(int64_t authSeq, const AuthSessionInfo *info)
|
||||
{
|
||||
LnnEventExtra extra = { 0 };
|
||||
LnnEventExtraInit(&extra);
|
||||
extra.authId = (int32_t)authSeq;
|
||||
if (info != NULL) {
|
||||
extra.authRequestId = (int32_t)info->requestId;
|
||||
}
|
||||
LNN_EVENT(EVENT_SCENE_JOIN_LNN, EVENT_STAGE_AUTH_DEVICE_INFO_POST, extra);
|
||||
}
|
||||
|
||||
int32_t PostDeviceInfoMessage(int64_t authSeq, const AuthSessionInfo *info)
|
||||
{
|
||||
DfxRecordLnnPostDeviceInfoStart(authSeq);
|
||||
DfxRecordLnnPostDeviceInfoStart(authSeq, info);
|
||||
AUTH_CHECK_AND_RETURN_RET_LOGE(info != NULL, SOFTBUS_INVALID_PARAM, AUTH_FSM, "info is NULL");
|
||||
char *msg = PackDeviceInfoMessage(info->connInfo.type, info->version, false, info->uuid);
|
||||
if (msg == NULL) {
|
||||
|
@ -56,7 +56,7 @@ int32_t LnnPublishService(const char *pkgName, const PublishInfo *info, bool isI
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
if ((ret = DiscStartScan(MODULE_LNN, info)) != SOFTBUS_OK) {
|
||||
DfxRecordLnnDiscServiceEnd(DISC_SERVER_PUBLISH, pkgName, ret);
|
||||
DfxRecordLnnDiscServiceEnd(DISC_SERVER_PUBLISH, LNN_DEFAULT_PKG_NAME, ret);
|
||||
LNN_LOGE(LNN_BUILDER, "DiscStartScan failed\n");
|
||||
return ret;
|
||||
}
|
||||
@ -65,16 +65,17 @@ int32_t LnnPublishService(const char *pkgName, const PublishInfo *info, bool isI
|
||||
|
||||
int32_t LnnUnPublishService(const char *pkgName, int32_t publishId, bool isInnerRequest)
|
||||
{
|
||||
int32_t ret;
|
||||
if (!isInnerRequest) {
|
||||
if (DiscUnPublishService(pkgName, publishId) != SOFTBUS_OK) {
|
||||
DfxRecordLnnDiscServiceEnd(DISC_SERVER_STOP_PUBLISH, pkgName, SOFTBUS_ERR);
|
||||
if ((ret = DiscUnPublishService(pkgName, publishId)) != SOFTBUS_OK) {
|
||||
DfxRecordLnnDiscServiceEnd(DISC_SERVER_STOP_PUBLISH, pkgName, ret);
|
||||
LNN_LOGE(LNN_BUILDER, "DiscUnPublishService failed\n");
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
if (DiscUnpublish(MODULE_LNN, publishId) != SOFTBUS_OK) {
|
||||
DfxRecordLnnDiscServiceEnd(DISC_SERVER_STOP_PUBLISH, pkgName, SOFTBUS_ERR);
|
||||
if ((ret = DiscUnpublish(MODULE_LNN, publishId)) != SOFTBUS_OK) {
|
||||
DfxRecordLnnDiscServiceEnd(DISC_SERVER_STOP_PUBLISH, LNN_DEFAULT_PKG_NAME, ret);
|
||||
LNN_LOGE(LNN_BUILDER, "DiscUnpublish fail!\n");
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
@ -95,12 +96,12 @@ int32_t LnnStartDiscDevice(const char *pkgName, const SubscribeInfo *info, const
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
if ((ret = DiscSetDiscoverCallback(MODULE_LNN, &cb->innerCb)) != SOFTBUS_OK) {
|
||||
DfxRecordLnnDiscServiceEnd(DISC_SERVER_DISCOVERY, pkgName, ret);
|
||||
DfxRecordLnnDiscServiceEnd(DISC_SERVER_DISCOVERY, LNN_DEFAULT_PKG_NAME, ret);
|
||||
LNN_LOGE(LNN_BUILDER, "DiscSetDiscoverCallback failed\n");
|
||||
return ret;
|
||||
}
|
||||
if ((ret = DiscStartAdvertise(MODULE_LNN, info)) != SOFTBUS_OK) {
|
||||
DfxRecordLnnDiscServiceEnd(DISC_SERVER_DISCOVERY, pkgName, ret);
|
||||
DfxRecordLnnDiscServiceEnd(DISC_SERVER_DISCOVERY, LNN_DEFAULT_PKG_NAME, ret);
|
||||
LNN_LOGE(LNN_BUILDER, "DiscStartAdvertise failed\n");
|
||||
return ret;
|
||||
}
|
||||
@ -109,16 +110,17 @@ int32_t LnnStartDiscDevice(const char *pkgName, const SubscribeInfo *info, const
|
||||
|
||||
int32_t LnnStopDiscDevice(const char *pkgName, int32_t subscribeId, bool isInnerRequest)
|
||||
{
|
||||
int32_t ret;
|
||||
if (!isInnerRequest) {
|
||||
if (DiscStopDiscovery(pkgName, subscribeId) != SOFTBUS_OK) {
|
||||
DfxRecordLnnDiscServiceEnd(DISC_SERVER_STOP_DISCOVERY, pkgName, SOFTBUS_ERR);
|
||||
if ((ret = DiscStopDiscovery(pkgName, subscribeId)) != SOFTBUS_OK) {
|
||||
DfxRecordLnnDiscServiceEnd(DISC_SERVER_STOP_DISCOVERY, pkgName, ret);
|
||||
LNN_LOGE(LNN_BUILDER, "DiscStopDiscovery failed\n");
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
if (DiscStopAdvertise(MODULE_LNN, subscribeId) != SOFTBUS_OK) {
|
||||
DfxRecordLnnDiscServiceEnd(DISC_SERVER_STOP_DISCOVERY, pkgName, SOFTBUS_ERR);
|
||||
if ((ret = DiscStopAdvertise(MODULE_LNN, subscribeId)) != SOFTBUS_OK) {
|
||||
DfxRecordLnnDiscServiceEnd(DISC_SERVER_STOP_DISCOVERY, LNN_DEFAULT_PKG_NAME, ret);
|
||||
LNN_LOGE(LNN_BUILDER, "DiscStopAdvertise fail!\n");
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "lnn_device_info.h"
|
||||
#include "lnn_device_info_recovery.h"
|
||||
#include "lnn_distributed_net_ledger.h"
|
||||
#include "lnn_event.h"
|
||||
#include "lnn_feature_capability.h"
|
||||
#include "lnn_heartbeat_strategy.h"
|
||||
#include "lnn_heartbeat_utils.h"
|
||||
@ -427,6 +428,23 @@ static int32_t SoftBusNetNodeResult(DeviceInfo *device, bool isConnect)
|
||||
}
|
||||
}
|
||||
|
||||
static void DfxRecordHeartBeatAuthStart(const AuthConnInfo *connInfo, const char *packageName, uint32_t requestId)
|
||||
{
|
||||
LnnEventExtra extra = { 0 };
|
||||
LnnEventExtraInit(&extra);
|
||||
extra.authRequestId = (int32_t)requestId;
|
||||
|
||||
if (connInfo != NULL) {
|
||||
extra.authLinkType = connInfo->type;
|
||||
}
|
||||
char pkgName[PKG_NAME_SIZE_MAX] = { 0 };
|
||||
if (packageName != NULL && IsValidString(packageName, PKG_NAME_SIZE_MAX - 1) && strncpy_s(pkgName,
|
||||
PKG_NAME_SIZE_MAX, packageName, PKG_NAME_SIZE_MAX - 1) == EOK) {
|
||||
extra.callerPkg = pkgName;
|
||||
}
|
||||
LNN_EVENT(EVENT_SCENE_JOIN_LNN, EVENT_STAGE_AUTH, extra);
|
||||
}
|
||||
|
||||
static int32_t HbNotifyReceiveDevice(DeviceInfo *device, int32_t weight,
|
||||
int32_t masterWeight, LnnHeartbeatType hbType, bool isOnlineDirectly, HbRespData *hbResp)
|
||||
{
|
||||
@ -469,6 +487,7 @@ static int32_t HbNotifyReceiveDevice(DeviceInfo *device, int32_t weight,
|
||||
AuthConnInfo authConn;
|
||||
uint32_t requestId = AuthGenRequestId();
|
||||
(void)LnnConvertAddrToAuthConnInfo(device->addr, &authConn);
|
||||
DfxRecordHeartBeatAuthStart(&authConn, LNN_DEFAULT_PKG_NAME, requestId);
|
||||
if (AuthStartVerify(&authConn, requestId, LnnGetReAuthVerifyCallback(), false) != SOFTBUS_OK) {
|
||||
LNN_LOGI(LNN_HEART_BEAT, "AuthStartVerify error");
|
||||
(void)SoftBusMutexUnlock(&g_hbRecvList->lock);
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "lnn_device_info.h"
|
||||
#include "lnn_device_info_recovery.h"
|
||||
#include "lnn_distributed_net_ledger.h"
|
||||
#include "lnn_event.h"
|
||||
#include "lnn_heartbeat_ctrl.h"
|
||||
#include "lnn_heartbeat_utils.h"
|
||||
#include "lnn_link_finder.h"
|
||||
@ -594,6 +595,21 @@ static int32_t LnnRecoveryBroadcastKey()
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
static void DfxRecordConnAuthStart(const AuthConnInfo *connInfo, LnnConnectionFsm *connFsm, uint32_t requestId)
|
||||
{
|
||||
LnnEventExtra extra = { 0 };
|
||||
LnnEventExtraInit(&extra);
|
||||
extra.authRequestId = (int32_t)requestId;
|
||||
|
||||
if (connInfo != NULL) {
|
||||
extra.authLinkType = connInfo->type;
|
||||
}
|
||||
if (connFsm != NULL && IsValidString(connFsm->pkgName, PKG_NAME_SIZE_MAX - 1)) {
|
||||
extra.callerPkg = connFsm->pkgName;
|
||||
}
|
||||
LNN_EVENT(EVENT_SCENE_JOIN_LNN, EVENT_STAGE_AUTH, extra);
|
||||
}
|
||||
|
||||
static int32_t OnJoinLNN(LnnConnectionFsm *connFsm)
|
||||
{
|
||||
int32_t rc;
|
||||
@ -633,6 +649,7 @@ static int32_t OnJoinLNN(LnnConnectionFsm *connFsm)
|
||||
}
|
||||
}
|
||||
}
|
||||
DfxRecordConnAuthStart(&authConn, connFsm, connInfo->requestId);
|
||||
if (AuthStartVerify(&authConn, connInfo->requestId, LnnGetVerifyCallback(), true) != SOFTBUS_OK) {
|
||||
LNN_LOGE(LNN_BUILDER, "auth verify device failed. [id=%{public}u]", connFsm->id);
|
||||
CompleteJoinLNN(connFsm, NULL, SOFTBUS_ERR);
|
||||
|
@ -567,6 +567,62 @@ static bool IsNeedWifiReauth(const char *networkId, const char *newAccountHash,
|
||||
return memcmp(info.accountHash, newAccountHash, HB_SHORT_ACCOUNT_HASH_LEN) != 0;
|
||||
}
|
||||
|
||||
static void BuildLnnEvent(LnnEventExtra *lnnEventExtra, const ConnectionAddr *addr)
|
||||
{
|
||||
if (lnnEventExtra == NULL || addr == NULL) {
|
||||
LNN_LOGW(LNN_STATE, "lnnEventExtra or addr is null");
|
||||
return;
|
||||
}
|
||||
switch (addr->type) {
|
||||
case CONNECTION_ADDR_BR:
|
||||
lnnEventExtra->peerBrMac = addr->info.br.brMac;
|
||||
break;
|
||||
case CONNECTION_ADDR_BLE:
|
||||
lnnEventExtra->peerBleMac = addr->info.ble.bleMac;
|
||||
break;
|
||||
case CONNECTION_ADDR_WLAN:
|
||||
/* fall-through */
|
||||
case CONNECTION_ADDR_ETH:
|
||||
lnnEventExtra->peerIp = addr->info.ip.ip;
|
||||
break;
|
||||
default:
|
||||
LNN_LOGE(LNN_BUILDER, "unknown param type!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void DfxRecordLnnServerjoinStart(const ConnectionAddr *addr, const char *packageName, bool needReportFailure)
|
||||
{
|
||||
LnnEventExtra extra = { 0 };
|
||||
LnnEventExtraInit(&extra);
|
||||
extra.lnnType = needReportFailure ? LNN_TYPE_MANUAL : LNN_TYPE_AUTOMATIC;
|
||||
|
||||
char pkgName[PKG_NAME_SIZE_MAX] = { 0 };
|
||||
if (packageName != NULL && IsValidString(packageName, PKG_NAME_SIZE_MAX - 1) && strncpy_s(pkgName,
|
||||
PKG_NAME_SIZE_MAX, packageName, PKG_NAME_SIZE_MAX - 1) == EOK) {
|
||||
extra.callerPkg = pkgName;
|
||||
}
|
||||
if (addr != NULL) {
|
||||
BuildLnnEvent(&extra, addr);
|
||||
}
|
||||
LNN_EVENT(EVENT_SCENE_JOIN_LNN, EVENT_STAGE_JOIN_LNN_START, extra);
|
||||
}
|
||||
|
||||
static void DfxRecordLnnAuthStart(const AuthConnInfo *connInfo, const JoinLnnMsgPara *para, uint32_t requestId)
|
||||
{
|
||||
LnnEventExtra extra = { 0 };
|
||||
LnnEventExtraInit(&extra);
|
||||
extra.authRequestId = (int32_t)requestId;
|
||||
|
||||
if (connInfo != NULL) {
|
||||
extra.authLinkType = connInfo->type;
|
||||
}
|
||||
if (para != NULL && IsValidString(para->pkgName, PKG_NAME_SIZE_MAX - 1)) {
|
||||
extra.callerPkg = para->pkgName;
|
||||
}
|
||||
LNN_EVENT(EVENT_SCENE_JOIN_LNN, EVENT_STAGE_AUTH, extra);
|
||||
}
|
||||
|
||||
static int32_t TrySendJoinLNNRequest(const JoinLnnMsgPara *para, bool needReportFailure, bool isShort)
|
||||
{
|
||||
LnnConnectionFsm *connFsm = NULL;
|
||||
@ -578,6 +634,7 @@ static int32_t TrySendJoinLNNRequest(const JoinLnnMsgPara *para, bool needReport
|
||||
if (!para->isNeedConnect) {
|
||||
isShort = true;
|
||||
}
|
||||
DfxRecordLnnServerjoinStart(¶->addr, para->pkgName, needReportFailure);
|
||||
connFsm = FindConnectionFsmByAddr(¶->addr, isShort);
|
||||
if (connFsm == NULL || connFsm->isDead) {
|
||||
if (TryPendingJoinRequest(para, needReportFailure)) {
|
||||
@ -608,6 +665,7 @@ static int32_t TrySendJoinLNNRequest(const JoinLnnMsgPara *para, bool needReport
|
||||
AuthConnInfo authConn;
|
||||
uint32_t requestId = AuthGenRequestId();
|
||||
(void)LnnConvertAddrToAuthConnInfo(&addr, &authConn);
|
||||
DfxRecordLnnAuthStart(&authConn, para, requestId);
|
||||
if (AuthStartVerify(&authConn, requestId, LnnGetReAuthVerifyCallback(), false) != SOFTBUS_OK) {
|
||||
LNN_LOGI(LNN_BUILDER, "AuthStartVerify error");
|
||||
return SOFTBUS_ERR;
|
||||
@ -1895,48 +1953,6 @@ static JoinLnnMsgPara *CreateJoinLnnMsgPara(const ConnectionAddr *addr, const ch
|
||||
return para;
|
||||
}
|
||||
|
||||
static void BuildLnnEvent(LnnEventExtra *lnnEventExtra, ConnectionAddr *addr)
|
||||
{
|
||||
if (lnnEventExtra == NULL || addr == NULL) {
|
||||
LNN_LOGW(LNN_STATE, "lnnEventExtra or addr is null");
|
||||
return;
|
||||
}
|
||||
switch (addr->type) {
|
||||
case CONNECTION_ADDR_BR:
|
||||
lnnEventExtra->peerBrMac = addr->info.br.brMac;
|
||||
break;
|
||||
case CONNECTION_ADDR_BLE:
|
||||
lnnEventExtra->peerBleMac = addr->info.ble.bleMac;
|
||||
break;
|
||||
case CONNECTION_ADDR_WLAN:
|
||||
/* fall-through */
|
||||
case CONNECTION_ADDR_ETH:
|
||||
lnnEventExtra->peerIp = addr->info.ip.ip;
|
||||
break;
|
||||
default:
|
||||
LNN_LOGE(LNN_BUILDER, "unknown param type!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void DfxRecordLnnServerjoinEnd(ConnectionAddr *addr, const char *packageName, int32_t reason)
|
||||
{
|
||||
LnnEventExtra extra = { 0 };
|
||||
LnnEventExtraInit(&extra);
|
||||
extra.errcode = reason;
|
||||
extra.result = (reason == SOFTBUS_OK) ? EVENT_STAGE_RESULT_OK : EVENT_STAGE_RESULT_FAILED;
|
||||
|
||||
char pkgName[PKG_NAME_SIZE_MAX] = { 0 };
|
||||
if (packageName != NULL && IsValidString(packageName, PKG_NAME_SIZE_MAX - 1) && strncpy_s(pkgName,
|
||||
PKG_NAME_SIZE_MAX, packageName, PKG_NAME_SIZE_MAX - 1) == EOK) {
|
||||
extra.callerPkg = pkgName;
|
||||
}
|
||||
if (addr != NULL) {
|
||||
BuildLnnEvent(&extra, addr);
|
||||
}
|
||||
LNN_EVENT(EVENT_SCENE_JOIN_LNN, EVENT_STAGE_JOIN_LNN_START, extra);
|
||||
}
|
||||
|
||||
static char *CreateNetworkIdMsgPara(const char *networkId)
|
||||
{
|
||||
char *para = NULL;
|
||||
@ -2325,23 +2341,19 @@ int32_t LnnServerJoin(ConnectionAddr *addr, const char *pkgName)
|
||||
|
||||
LNN_LOGI(LNN_BUILDER, "enter!");
|
||||
if (g_netBuilder.isInit == false) {
|
||||
DfxRecordLnnServerjoinEnd(addr, pkgName, SOFTBUS_NO_INIT);
|
||||
LNN_LOGE(LNN_BUILDER, "no init");
|
||||
return SOFTBUS_NO_INIT;
|
||||
}
|
||||
para = CreateJoinLnnMsgPara(addr, pkgName, true);
|
||||
if (para == NULL) {
|
||||
DfxRecordLnnServerjoinEnd(addr, pkgName, SOFTBUS_MALLOC_ERR);
|
||||
LNN_LOGE(LNN_BUILDER, "prepare join lnn message fail");
|
||||
return SOFTBUS_MALLOC_ERR;
|
||||
}
|
||||
if (PostMessageToHandler(MSG_TYPE_JOIN_LNN, para) != SOFTBUS_OK) {
|
||||
DfxRecordLnnServerjoinEnd(addr, pkgName, SOFTBUS_NETWORK_LOOPER_ERR);
|
||||
LNN_LOGE(LNN_BUILDER, "post join lnn message fail");
|
||||
SoftBusFree(para);
|
||||
return SOFTBUS_NETWORK_LOOPER_ERR;
|
||||
}
|
||||
DfxRecordLnnServerjoinEnd(addr, pkgName, SOFTBUS_OK);
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,7 @@ LNN_ASSIGNER(Int32, GearCycle, gearCycle)
|
||||
LNN_ASSIGNER(Int32, GearDuration, gearDuration)
|
||||
LNN_ASSIGNER(Int32, ConnectionId, connectionId)
|
||||
LNN_ASSIGNER(Int32, AuthLinkType, authLinkType)
|
||||
LNN_ASSIGNER(Int32, AuthRequestId, authRequestId)
|
||||
LNN_ASSIGNER(Int32, AuthCostTime, authCostTime)
|
||||
LNN_ASSIGNER(Int32, LnnType, lnnType)
|
||||
LNN_ASSIGNER(Int32, OnlineNum, onlineNum)
|
||||
@ -58,7 +59,7 @@ LNN_ASSIGNER(String, PeerDeviceType, peerDeviceType)
|
||||
LNN_ASSIGNER(String, CallerPkg, callerPkg)
|
||||
LNN_ASSIGNER(String, CalleePkg, calleePkg)
|
||||
|
||||
#define LNN_ASSIGNER_SIZE 23 // Size of g_connAssigners
|
||||
#define LNN_ASSIGNER_SIZE 24 // Size of g_connAssigners
|
||||
static const HiSysEventParamAssigner g_lnnAssigners[] = {
|
||||
{ "STAGE_RES", HISYSEVENT_INT32, LnnAssignerResult },
|
||||
{ "ERROR_CODE", HISYSEVENT_INT32, LnnAssignerErrcode },
|
||||
@ -68,6 +69,7 @@ static const HiSysEventParamAssigner g_lnnAssigners[] = {
|
||||
{ "GEAR_DURATION", HISYSEVENT_INT32, LnnAssignerGearDuration },
|
||||
{ "CONN_ID", HISYSEVENT_INT32, LnnAssignerConnectionId },
|
||||
{ "AUTH_LINK_TYPE", HISYSEVENT_INT32, LnnAssignerAuthLinkType },
|
||||
{ "AUTH_REQUEST_ID", HISYSEVENT_INT32, LnnAssignerAuthRequestId },
|
||||
{ "AUTH_COST_TIME", HISYSEVENT_INT32, LnnAssignerAuthCostTime },
|
||||
{ "LNN_TYPE", HISYSEVENT_INT32, LnnAssignerLnnType },
|
||||
{ "ONLINE_NUM", HISYSEVENT_INT32, LnnAssignerOnlineNum },
|
||||
|
@ -26,6 +26,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define LNN_DEFAULT_PKG_NAME "MODULE_LNN"
|
||||
|
||||
typedef enum {
|
||||
EVENT_SCENE_LNN = 1,
|
||||
EVENT_SCENE_JOIN_LNN = 2,
|
||||
@ -66,6 +68,11 @@ typedef enum {
|
||||
DISC_SERVER_STOP_DISCOVERY = 4,
|
||||
} LnnDiscServerType;
|
||||
|
||||
typedef enum {
|
||||
LNN_TYPE_AUTOMATIC = 1,
|
||||
LNN_TYPE_MANUAL = 2,
|
||||
} LnnType;
|
||||
|
||||
typedef struct {
|
||||
int32_t result; // STAGE_RES
|
||||
int32_t errcode; // ERROR_CODE
|
||||
@ -75,6 +82,7 @@ typedef struct {
|
||||
int32_t gearDuration; // GEAR_DURATION
|
||||
int32_t connectionId; // CONN_ID
|
||||
int32_t authLinkType; // AUTH_LINK_TYPE
|
||||
int32_t authRequestId; // AUTH_REQUEST_ID
|
||||
int32_t authCostTime; // AUTH_COST_TIME
|
||||
int32_t lnnType; // LNN_TYPE
|
||||
int32_t onlineNum; // ONLINE_NUM
|
||||
|
@ -134,6 +134,9 @@ HWTEST_F(AuthHichainTest, ON_REQUEST_TEST_001, TestSize.Level1)
|
||||
const char *groupInfo;
|
||||
OnDeviceBound(NULL, groupInfo);
|
||||
OnDeviceBound(udid, groupInfo);
|
||||
|
||||
DfxRecordLnnExchangekeyEnd(authSeq, SOFTBUS_OK);
|
||||
DfxRecordLnnEndHichainEnd(authSeq, SOFTBUS_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -399,11 +399,11 @@ HWTEST_F(AuthManagerTest, HANDLE_RECONNECT_RESULT_TEST_001, TestSize.Level1)
|
||||
EXPECT_TRUE(AddAuthRequest(&request) == SOFTBUS_OK);
|
||||
HandleBleConnectResult(REQUEST_ID_1, AUTH_SEQ, CONN_ID, SOFTBUS_OK, 0);
|
||||
HandleBleConnectResult(REQUEST_ID, AUTH_SEQ, CONN_ID, SOFTBUS_OK, 0);
|
||||
DfxRecordLnnConnectEnd(CONN_ID_1, nullptr, SOFTBUS_OK);
|
||||
DfxRecordLnnConnectEnd(REQUEST_ID_1, CONN_ID_1, nullptr, SOFTBUS_OK);
|
||||
AuthConnInfo connInfo;
|
||||
(void)memset_s(&connInfo, sizeof(AuthConnInfo), 0, sizeof(AuthConnInfo));
|
||||
connInfo.type = AUTH_LINK_TYPE_WIFI;
|
||||
DfxRecordLnnConnectEnd(CONN_ID_1, &connInfo, SOFTBUS_OK);
|
||||
DfxRecordLnnConnectEnd(REQUEST_ID_1, CONN_ID_1, &connInfo, SOFTBUS_OK);
|
||||
OnConnectResult(REQUEST_ID_1, CONN_ID_1, SOFTBUS_OK, &connInfo);
|
||||
OnConnectResult(REQUEST_ID, CONN_ID_1, SOFTBUS_OK, &connInfo);
|
||||
connInfo.type = AUTH_LINK_TYPE_BLE;
|
||||
|
@ -116,6 +116,7 @@ HWTEST_F(LNNConnectionFsmTest, LNN_CREATE_CONNECTION_FSM_TEST_001, TestSize.Leve
|
||||
LnnConnectionFsm *fsm = LnnCreateConnectionFsm(target1, "pkgName", true);
|
||||
EXPECT_TRUE(fsm == nullptr);
|
||||
LnnDestroyConnectionFsm(fsm);
|
||||
DfxRecordConnAuthStart(nullptr, fsm, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1359,6 +1359,7 @@ HWTEST_F(LNNNetBuilderMockTest, TRY_SEND_JOIN_LNN_REQUEST_TEST_001, TestSize.Lev
|
||||
EXPECT_TRUE(TrySendJoinLNNRequest(nullptr, true, false) == SOFTBUS_INVALID_PARAM);
|
||||
EXPECT_TRUE(TrySendJoinLNNRequest(para, true, false) == SOFTBUS_ERR);
|
||||
|
||||
DfxRecordLnnAuthStart(nullptr, para, 0);
|
||||
ListDelete(&connFsm->node);
|
||||
SoftBusFree(connFsm);
|
||||
}
|
||||
|
@ -121,6 +121,7 @@ HWTEST_F(LNNDisctributedLedgerTest, LNN_ADD_ONLINE_NODE_Test_001, TestSize.Level
|
||||
(void)strncpy_s(info.networkId, NETWORK_ID_BUF_LEN, NODE1_NETWORK_ID, strlen(NODE1_NETWORK_ID));
|
||||
(void)strncpy_s(info.connectInfo.macAddr, MAC_LEN, NODE1_BT_MAC, strlen(NODE1_BT_MAC));
|
||||
EXPECT_TRUE(REPORT_NONE == LnnAddOnlineNode(&info));
|
||||
DfxRecordLnnAddOnlineNodeEnd(&info, 1, SOFTBUS_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -283,6 +284,7 @@ HWTEST_F(LNNDisctributedLedgerTest, LNN_SET_NODE_OFFLINE_Test_001, TestSize.Leve
|
||||
{
|
||||
EXPECT_TRUE(REPORT_NONE == LnnSetNodeOffline(NODE1_UDID, CONNECTION_ADDR_WLAN, AUTH_ID));
|
||||
EXPECT_TRUE(REPORT_NONE == LnnSetNodeOffline(NODE2_UDID, CONNECTION_ADDR_WLAN, AUTH_ID));
|
||||
DfxRecordLnnSetNodeOfflineEnd(NODE1_UDID, 1, SOFTBUS_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -314,6 +314,7 @@ HWTEST_F(HeartBeatMediumTest, HbMediumMgrRecvProcessTest_01, TestSize.Level1)
|
||||
(void)memset_s(&device, sizeof(DeviceInfo), 0, sizeof(DeviceInfo));
|
||||
ret = HbMediumMgrRecvProcess(&device, weight, masterWeight, HEARTBEAT_TYPE_BLE_V1, false, &hbResp);
|
||||
EXPECT_TRUE(ret == SOFTBUS_NETWORK_HEARTBEAT_UNTRUSTED);
|
||||
DfxRecordHeartBeatAuthStart(nullptr, "pkgName", 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -63,6 +63,10 @@ MATCHER_P2(LnnValidParamArrayMatcher, inExtra, validSize, "lnn valid param array
|
||||
++index;
|
||||
EXPECT_STREQ(params[index].name, g_lnnAssigners[index].name);
|
||||
EXPECT_EQ(params[index].t, g_lnnAssigners[index].type);
|
||||
EXPECT_EQ(params[index].v.i32, extra.authRequestId);
|
||||
++index;
|
||||
EXPECT_STREQ(params[index].name, g_lnnAssigners[index].name);
|
||||
EXPECT_EQ(params[index].t, g_lnnAssigners[index].type);
|
||||
EXPECT_EQ(params[index].v.i32, extra.authCostTime);
|
||||
++index;
|
||||
EXPECT_STREQ(params[index].name, g_lnnAssigners[index].name);
|
||||
|
@ -68,10 +68,11 @@ HWTEST_F(LnnEventTest, LnnEventTest002, TestSize.Level0)
|
||||
.gearDuration = 6,
|
||||
.connectionId = 7,
|
||||
.authLinkType = 8,
|
||||
.authCostTime = 9,
|
||||
.lnnType = 10,
|
||||
.onlineNum = 11,
|
||||
.peerDeviceAbility = 12,
|
||||
.authRequestId = 9,
|
||||
.authCostTime = 10,
|
||||
.lnnType = 11,
|
||||
.onlineNum = 12,
|
||||
.peerDeviceAbility = 13,
|
||||
.peerDeviceInfo = "testPeerDeviceInfo",
|
||||
.peerIp = "10.11.12.1",
|
||||
.peerBrMac = "dd:15:bc:b9:f2:04",
|
||||
@ -111,10 +112,11 @@ HWTEST_F(LnnEventTest, LnnEventTest003, TestSize.Level0)
|
||||
.gearDuration = -6,
|
||||
.connectionId = -7,
|
||||
.authLinkType = -8,
|
||||
.authCostTime = -9,
|
||||
.lnnType = -10,
|
||||
.onlineNum = -11,
|
||||
.peerDeviceAbility = -12,
|
||||
.authRequestId = -9,
|
||||
.authCostTime = -10,
|
||||
.lnnType = -11,
|
||||
.onlineNum = -12,
|
||||
.peerDeviceAbility = -13,
|
||||
.peerDeviceInfo = "",
|
||||
.peerIp = "",
|
||||
.peerBrMac = "",
|
||||
|
Loading…
Reference in New Issue
Block a user