fix bug of get local ip for p2p_reuse

Signed-off-by: wuchunbo <wuchunbo1@huawei.com>
This commit is contained in:
wuchunbo 2024-01-11 22:18:43 +08:00
parent 8d6a515bfc
commit 35b1b6bb1a
2 changed files with 11 additions and 2 deletions

View File

@ -44,6 +44,7 @@
#include "trans_tcp_direct_sessionconn.h"
#include "lnn_network_manager.h"
#include "trans_event.h"
#include "wifi_direct_manager.h"
#define MIGRATE_ENABLE 2
#define MIGRATE_SUPPORTED 1
@ -390,8 +391,15 @@ static void FillAppInfo(AppInfo *appInfo, const SessionParam *param,
appInfo->linkType = connInfo->type;
appInfo->channelType = transInfo->channelType;
(void)TransGetLocalConfig(appInfo->channelType, appInfo->businessType, &appInfo->myData.dataConfig);
if (strcpy_s(appInfo->myData.addr, IP_LEN, connInfo->connInfo.p2p.localIp) != EOK) {
TRANS_LOGE(TRANS_CTRL, "copy local ip failed");
if (connInfo->type == LANE_P2P || connInfo->type == LANE_HML) {
if (strcpy_s(appInfo->myData.addr, IP_LEN, connInfo->connInfo.p2p.localIp) != EOK) {
TRANS_LOGE(TRANS_CTRL, "copy local ip failed");
}
} else if (connInfo->type == LANE_P2P_REUSE) {
if (GetWifiDirectManager()->getLocalIpByRemoteIp(connInfo->connInfo.wlan.addr, appInfo->myData.addr, IP_LEN) !=
SOFTBUS_OK) {
TRANS_LOGE(TRANS_CTRL, "get local ip failed");
}
}
}

View File

@ -31,6 +31,7 @@ ohos_unittest("TransChannelManagerTest") {
"$dsoftbus_root_path/core/discovery/manager/include",
"$dsoftbus_root_path/interfaces/kits/common",
"$dsoftbus_root_path/core/connection/interface",
"$dsoftbus_root_path/core/connection/wifi_direct",
"$dsoftbus_root_path/core/transmission/common/include",
"$dsoftbus_root_path/core/transmission/trans_channel/common/include",
"$dsoftbus_root_path/core/transmission/trans_channel/auth/src",