mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-11-27 02:40:40 +00:00
!6800 Fix: add dimension test log
Merge pull request !6800 from wangyipeng/master
This commit is contained in:
commit
fd7c411720
@ -98,7 +98,7 @@ int32_t CheckTransPermission(pid_t callingUid, pid_t callingPid,
|
||||
}
|
||||
Anonymize(sessionName, &tmpName);
|
||||
COMM_LOGE(COMM_PERM, "permission denied, permType=%{public}d, ret=%{public}d, sessionName=%{public}s, \
|
||||
callingUid=%{piblic}d, callingPid=%{public}d", permType, ret, tmpName, callingUid, callingPid);
|
||||
callingUid=%{public}d, callingPid=%{public}d", permType, ret, tmpName, callingUid, callingPid);
|
||||
AnonymizeFree(tmpName);
|
||||
return SOFTBUS_PERMISSION_DENIED;
|
||||
}
|
||||
|
@ -409,7 +409,6 @@ int32_t UnpackReplyErrCode(const cJSON *msg, int32_t *errCode)
|
||||
}
|
||||
|
||||
if (!GetJsonObjectInt32Item(msg, ERR_CODE, errCode)) {
|
||||
TRANS_LOGW(TRANS_CTRL, "unpack reply faild");
|
||||
return SOFTBUS_PARSE_JSON_ERR;
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,6 @@ int32_t TransLaneMgrAddLane(
|
||||
|
||||
int32_t TransLaneMgrDelLane(int32_t channelId, int32_t channelType)
|
||||
{
|
||||
TRANS_LOGI(TRANS_SVC, "del trans land mgr. chanId=%{public}d channelType=%{public}d", channelId, channelType);
|
||||
if (g_channelLaneList == NULL) {
|
||||
TRANS_LOGE(TRANS_INIT, "trans lane manager hasn't init.");
|
||||
return SOFTBUS_NO_INIT;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -87,9 +87,11 @@ int32_t GetCipherFlagByAuthId(AuthHandle authHandle, uint32_t *flag, bool *isAut
|
||||
|
||||
static int32_t StartVerifySession(SessionConn *conn)
|
||||
{
|
||||
TRANS_LOGI(TRANS_CTRL, "enter.");
|
||||
TRANS_LOGI(TRANS_CTRL, "verify enter. channelId=%{public}d, fd=%{public}d", conn->channelId, conn->appInfo.fd);
|
||||
if (SoftBusGenerateSessionKey(conn->appInfo.sessionKey, SESSION_KEY_LENGTH) != SOFTBUS_OK) {
|
||||
TRANS_LOGE(TRANS_CTRL, "Generate SessionKey failed");
|
||||
TRANS_LOGE(TRANS_CTRL,
|
||||
"Generate SessionKey failed channelId=%{public}d, fd=%{public}d",
|
||||
conn->channelId, conn->appInfo.fd);
|
||||
return SOFTBUS_TRANS_TCP_GENERATE_SESSIONKEY_FAILED;
|
||||
}
|
||||
SetSessionKeyByChanId(conn->channelId, conn->appInfo.sessionKey, sizeof(conn->appInfo.sessionKey));
|
||||
@ -97,7 +99,9 @@ static int32_t StartVerifySession(SessionConn *conn)
|
||||
uint32_t cipherFlag = FLAG_WIFI;
|
||||
bool isLegacyOs = IsPeerDeviceLegacyOs(conn->appInfo.osType);
|
||||
if (GetCipherFlagByAuthId(conn->authHandle, &cipherFlag, &isAuthServer, isLegacyOs)) {
|
||||
TRANS_LOGE(TRANS_CTRL, "get cipher flag failed");
|
||||
TRANS_LOGE(TRANS_CTRL,
|
||||
"get cipher flag failed channelId=%{public}d, fd=%{public}d",
|
||||
conn->channelId, conn->appInfo.fd);
|
||||
return SOFTBUS_TRANS_GET_CIPHER_FAILED;
|
||||
}
|
||||
uint64_t seq = TransTdcGetNewSeqId();
|
||||
@ -106,7 +110,9 @@ static int32_t StartVerifySession(SessionConn *conn)
|
||||
}
|
||||
char *bytes = PackRequest(&conn->appInfo);
|
||||
if (bytes == NULL) {
|
||||
TRANS_LOGE(TRANS_CTRL, "Pack Request failed");
|
||||
TRANS_LOGE(TRANS_CTRL,
|
||||
"Pack Request failed channelId=%{public}d, fd=%{public}d",
|
||||
conn->channelId, conn->appInfo.fd);
|
||||
return SOFTBUS_TRANS_PACK_REQUEST_FAILED;
|
||||
}
|
||||
TdcPacketHead packetHead = {
|
||||
@ -120,13 +126,14 @@ static int32_t StartVerifySession(SessionConn *conn)
|
||||
packetHead.flags |= FLAG_AUTH_META;
|
||||
}
|
||||
int32_t ret = TransTdcPostBytes(conn->channelId, &packetHead, bytes);
|
||||
cJSON_free(bytes);
|
||||
if (ret != SOFTBUS_OK) {
|
||||
TRANS_LOGE(TRANS_CTRL, "TransTdc post bytes failed");
|
||||
cJSON_free(bytes);
|
||||
TRANS_LOGE(TRANS_CTRL,
|
||||
"TransTdc post bytes failed channelId=%{public}d, fd=%{public}d, ret=%{public}d",
|
||||
conn->channelId, conn->appInfo.fd, ret);
|
||||
return ret;
|
||||
}
|
||||
cJSON_free(bytes);
|
||||
TRANS_LOGI(TRANS_CTRL, "ok");
|
||||
TRANS_LOGI(TRANS_CTRL, "verify ok. channelId=%{public}d, fd=%{public}d", conn->channelId, conn->appInfo.fd);
|
||||
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
@ -607,14 +607,16 @@ static int32_t TransTdcProcessDataConfig(AppInfo *appInfo)
|
||||
static int32_t OpenDataBusReply(int32_t channelId, uint64_t seq, const cJSON *reply)
|
||||
{
|
||||
(void)seq;
|
||||
TRANS_LOGI(TRANS_CTRL, "channelId=%{public}d", channelId);
|
||||
TRANS_LOGI(TRANS_CTRL, "channelId=%{public}d, seq=%{public}" PRIu64, channelId, seq);
|
||||
SessionConn conn;
|
||||
(void)memset_s(&conn, sizeof(SessionConn), 0, sizeof(SessionConn));
|
||||
TRANS_CHECK_AND_RETURN_RET_LOGE(GetSessionConnById(channelId, &conn) == SOFTBUS_OK,
|
||||
SOFTBUS_TRANS_GET_SESSION_CONN_FAILED, TRANS_CTRL, "notify channel open failed, get tdcInfo is null");
|
||||
int32_t errCode = SOFTBUS_OK;
|
||||
if (UnpackReplyErrCode(reply, &errCode) == SOFTBUS_OK) {
|
||||
TRANS_LOGE(TRANS_CTRL, "receive err reply msg");
|
||||
TRANS_LOGE(TRANS_CTRL,
|
||||
"receive err reply msg channelId=%{public}d, errCode=%{public}d, seq=%{public}" PRIu64,
|
||||
channelId, errCode, seq);
|
||||
return errCode;
|
||||
}
|
||||
uint16_t fastDataSize = 0;
|
||||
@ -644,7 +646,8 @@ static int32_t OpenDataBusReply(int32_t channelId, uint64_t seq, const cJSON *re
|
||||
.calleePkg = NULL,
|
||||
.callerPkg = NULL,
|
||||
.channelId = channelId,
|
||||
.result = EVENT_STAGE_RESULT_OK };
|
||||
.result = EVENT_STAGE_RESULT_OK
|
||||
};
|
||||
TRANS_EVENT(EVENT_SCENE_OPEN_CHANNEL, EVENT_STAGE_HANDSHAKE_REPLY, extra);
|
||||
TRANS_LOGD(TRANS_CTRL, "ok");
|
||||
return SOFTBUS_OK;
|
||||
@ -1098,7 +1101,9 @@ static int32_t ProcessReceivedData(int32_t channelId, int32_t type)
|
||||
seq = pktHead->seq;
|
||||
flags = pktHead->flags;
|
||||
|
||||
TRANS_LOGI(TRANS_CTRL, "recv tdc packet, flags=%{public}d, seq=%{public}" PRIu64, flags, seq);
|
||||
TRANS_LOGI(TRANS_CTRL,
|
||||
"recv tdc packet. channelId=%{public}d, flags=%{public}d, seq=%{public}" PRIu64,
|
||||
channelId, flags, seq);
|
||||
if (DecryptMessage(channelId, pktHead, pktData, &data, &dataLen) != SOFTBUS_OK) {
|
||||
TRANS_LOGE(TRANS_CTRL, "srv process recv data: decrypt fail.");
|
||||
SoftBusMutexUnlock(&g_tcpSrvDataList->lock);
|
||||
|
@ -109,6 +109,9 @@ static void DelHmlListenerByMoudle(ListenerModule type)
|
||||
LIST_FOR_EACH_ENTRY_SAFE(item, nextItem, &g_hmlListenerList->list, HmlListenerInfo, node) {
|
||||
if (item->moudleType == type) {
|
||||
ListDelete(&item->node);
|
||||
TRANS_LOGI(TRANS_CTRL,
|
||||
"del hmlListener port=%{public}d, listenerModule=%{public}d",
|
||||
item->myPort, (int32_t)item->moudleType);
|
||||
SoftBusFree(item);
|
||||
g_hmlListenerList->cnt--;
|
||||
return;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -162,7 +162,7 @@ int32_t OpenTcpDirectChannel(const AppInfo *appInfo, const ConnectOption *connIn
|
||||
if (fd < 0) {
|
||||
FreeFastTransData(&(newConn->appInfo));
|
||||
SoftBusFree(newConn);
|
||||
TRANS_LOGE(TRANS_CTRL, "connect fail");
|
||||
TRANS_LOGE(TRANS_CTRL, "connect failed. fd=%{public}d", fd);
|
||||
return fd;
|
||||
}
|
||||
newConn->appInfo.fd = fd;
|
||||
@ -172,6 +172,8 @@ int32_t OpenTcpDirectChannel(const AppInfo *appInfo, const ConnectOption *connIn
|
||||
return ret;
|
||||
}
|
||||
*channelId = newchannelId;
|
||||
TRANS_LOGI(TRANS_CTRL, "ok: channelId=%{public}d", newchannelId);
|
||||
TRANS_LOGI(TRANS_CTRL,
|
||||
"ok: channelId=%{public}d, module=%{public}d, fd=%{public}d",
|
||||
newchannelId, (int32_t)module, fd);
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -31,8 +31,7 @@ int32_t ClientTransAuthOnChannelClosed(int32_t channelId, ShutdownReason reason)
|
||||
|
||||
int32_t ClientTransAuthOnChannelOpenFailed(int32_t channelId, int32_t errCode);
|
||||
|
||||
int32_t ClientTransAuthOnDataReceived(int32_t channelId,
|
||||
const void *data, uint32_t len, SessionPktType type);
|
||||
int32_t ClientTransAuthOnDataReceived(int32_t channelId, const void *data, uint32_t len, SessionPktType type);
|
||||
|
||||
void ClientTransAuthCloseChannel(int32_t channelId, ShutdownReason reason);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
#include "client_trans_auth_manager.h"
|
||||
#include "softbus_def.h"
|
||||
|
||||
#include "softbus_errcode.h"
|
||||
#include "trans_log.h"
|
||||
#include "trans_server_proxy.h"
|
||||
@ -38,7 +38,7 @@ int32_t ClientTransAuthOnChannelOpened(const char *sessionName, const ChannelInf
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
|
||||
int ret = g_sessionCb.OnSessionOpened(sessionName, channel, TYPE_MESSAGE);
|
||||
int32_t ret = g_sessionCb.OnSessionOpened(sessionName, channel, TYPE_MESSAGE);
|
||||
if (ret != SOFTBUS_OK) {
|
||||
TRANS_LOGE(TRANS_SDK, "notify session open fail, ret=%{public}d", ret);
|
||||
return ret;
|
||||
@ -49,7 +49,7 @@ int32_t ClientTransAuthOnChannelOpened(const char *sessionName, const ChannelInf
|
||||
|
||||
int32_t ClientTransAuthOnChannelClosed(int32_t channelId, ShutdownReason reason)
|
||||
{
|
||||
int ret = g_sessionCb.OnSessionClosed(channelId, CHANNEL_TYPE_AUTH, reason);
|
||||
int32_t ret = g_sessionCb.OnSessionClosed(channelId, CHANNEL_TYPE_AUTH, reason);
|
||||
if (ret != SOFTBUS_OK) {
|
||||
TRANS_LOGE(TRANS_SDK, "notify session open fail. ret=%{public}d, channelId=%{public}d", ret, channelId);
|
||||
return ret;
|
||||
@ -59,7 +59,7 @@ int32_t ClientTransAuthOnChannelClosed(int32_t channelId, ShutdownReason reason)
|
||||
|
||||
int32_t ClientTransAuthOnChannelOpenFailed(int32_t channelId, int32_t errCode)
|
||||
{
|
||||
int ret = g_sessionCb.OnSessionOpenFailed(channelId, CHANNEL_TYPE_AUTH, errCode);
|
||||
int32_t ret = g_sessionCb.OnSessionOpenFailed(channelId, CHANNEL_TYPE_AUTH, errCode);
|
||||
if (ret != SOFTBUS_OK) {
|
||||
TRANS_LOGE(TRANS_SDK,
|
||||
"notify session open fail. ret=%{public}d, errCode=%{public}d, channelId=%{public}d",
|
||||
@ -70,14 +70,13 @@ int32_t ClientTransAuthOnChannelOpenFailed(int32_t channelId, int32_t errCode)
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
int32_t ClientTransAuthOnDataReceived(int32_t channelId,
|
||||
const void *data, uint32_t len, SessionPktType type)
|
||||
int32_t ClientTransAuthOnDataReceived(int32_t channelId, const void *data, uint32_t len, SessionPktType type)
|
||||
{
|
||||
if (data == NULL) {
|
||||
TRANS_LOGE(TRANS_SDK, "param invalid");
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
int ret = g_sessionCb.OnDataReceived(channelId, CHANNEL_TYPE_AUTH, data, len, type);
|
||||
int32_t ret = g_sessionCb.OnDataReceived(channelId, CHANNEL_TYPE_AUTH, data, len, type);
|
||||
if (ret != SOFTBUS_OK) {
|
||||
TRANS_LOGE(TRANS_SDK, "notify data recv err, ret=%{public}d, channelId=%{public}d", ret, channelId);
|
||||
return ret;
|
||||
@ -98,14 +97,14 @@ void ClientTransAuthCloseChannel(int32_t channelId, ShutdownReason reason)
|
||||
|
||||
int32_t TransAuthChannelSendBytes(int32_t channelId, const void *data, uint32_t len)
|
||||
{
|
||||
int ret = ServerIpcSendMessage(channelId, CHANNEL_TYPE_AUTH, data, len, TRANS_SESSION_BYTES);
|
||||
int32_t ret = ServerIpcSendMessage(channelId, CHANNEL_TYPE_AUTH, data, len, TRANS_SESSION_BYTES);
|
||||
TRANS_LOGI(TRANS_BYTES, "send bytes: channelId=%{public}d, ret=%{public}d", channelId, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t TransAuthChannelSendMessage(int32_t channelId, const void *data, uint32_t len)
|
||||
{
|
||||
int ret = ServerIpcSendMessage(channelId, CHANNEL_TYPE_AUTH, data, len, TRANS_SESSION_BYTES);
|
||||
int32_t ret = ServerIpcSendMessage(channelId, CHANNEL_TYPE_AUTH, data, len, TRANS_SESSION_BYTES);
|
||||
TRANS_LOGI(TRANS_MSG, "send msg: channelId=%{public}d, ret=%{public}d", channelId, ret);
|
||||
return ret;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -107,7 +107,7 @@ int32_t TransTdcCreateListener(int32_t fd)
|
||||
SoftBusMutexUnlock(&g_lock.lock);
|
||||
return ret;
|
||||
}
|
||||
TRANS_LOGI(TRANS_SDK, "create sdk listener success.");
|
||||
TRANS_LOGI(TRANS_SDK, "create sdk listener success. fd=%{public}d", fd);
|
||||
}
|
||||
SoftBusMutexUnlock(&g_lock.lock);
|
||||
|
||||
|
@ -249,7 +249,7 @@ int32_t ClientTransTdcOnChannelOpened(const char *sessionName, const ChannelInfo
|
||||
goto EXIT_ERR;
|
||||
}
|
||||
ListAdd(&g_tcpDirectChannelInfoList->list, &item->node);
|
||||
TRANS_LOGI(TRANS_SDK, "add channelId=%{public}d", item->channelId);
|
||||
TRANS_LOGI(TRANS_SDK, "add channelId=%{public}d, fd=%{public}d", item->channelId, channel->fd);
|
||||
(void)SoftBusMutexUnlock(&g_tcpDirectChannelInfoList->lock);
|
||||
|
||||
ret = ClientTransTdcOnSessionOpened(sessionName, channel);
|
||||
|
Loading…
Reference in New Issue
Block a user