mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-12-18 15:28:15 +00:00
修复使用内部代理通道协商P2P的IP和端口时找不到认证密钥的问题
Signed-off-by: breakfei1 <zhangshen6@huawei.com>
This commit is contained in:
parent
8ad9bae714
commit
82a7459655
@ -542,8 +542,17 @@ static int32_t StartVerifyP2pInfo(const AppInfo *appInfo, SessionConn *conn)
|
||||
int32_t newChannelId = conn->channelId;
|
||||
int32_t pipeLineChannelId = GetPipelineIdByPeerNetworkId(appInfo->peerNetWorkId);
|
||||
if (pipeLineChannelId == INVALID_CHANNEL_ID) {
|
||||
uint32_t requestId = AuthGenRequestId();
|
||||
conn->status = TCP_DIRECT_CHANNEL_STATUS_AUTH_CHANNEL;
|
||||
conn->requestId = requestId;
|
||||
ret = OpenNewAuthConn(appInfo, conn, newChannelId, conn->requestId);
|
||||
} else {
|
||||
conn->authId = AuthGetLatestIdByUuid(conn->appInfo.peerData.deviceId, true, false);
|
||||
if (conn->authId == AUTH_INVALID_ID) {
|
||||
conn->authId = AuthGetLatestIdByUuid(conn->appInfo.peerData.deviceId, false, false);
|
||||
}
|
||||
TRAN_CHECK_AND_RETURN_RET_LOG(conn->authId != AUTH_INVALID_ID, SOFTBUS_ERR, "get auth id failed");
|
||||
conn->requestId = AUTH_INVALID_ID;
|
||||
char *msg = VerifyP2pPack(conn->appInfo.myData.addr, conn->appInfo.myData.port);
|
||||
if (msg == NULL) {
|
||||
return SOFTBUS_ERR;
|
||||
@ -595,15 +604,11 @@ NO_SANITIZE("cfi") int32_t OpenP2pDirectChannel(const AppInfo *appInfo, const Co
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint32_t requestId = AuthGenRequestId();
|
||||
conn->status = TCP_DIRECT_CHANNEL_STATUS_AUTH_CHANNEL;
|
||||
conn->requestId = requestId;
|
||||
uint64_t seq = TransTdcGetNewSeqId();
|
||||
if (seq == INVALID_SEQ_ID) {
|
||||
SoftBusFree(conn);
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
|
||||
conn->req = (int64_t)seq;
|
||||
conn->isMeta = TransGetAuthTypeByNetWorkId(appInfo->peerNetWorkId);
|
||||
ret = TransTdcAddSessionConn(conn);
|
||||
|
@ -261,8 +261,8 @@ NO_SANITIZE("cfi") void TransDelSessionConnById(int32_t channelId)
|
||||
}
|
||||
LIST_FOR_EACH_ENTRY_SAFE(item, next, &g_sessionConnList->list, SessionConn, node) {
|
||||
if (item->channelId == channelId) {
|
||||
if (item->listenMod == DIRECT_CHANNEL_SERVER_P2P && item->authId != AUTH_INVALID_ID
|
||||
&& !item->serverSide && item->appInfo.routeType != WIFI_P2P_REUSE) {
|
||||
if (item->listenMod == DIRECT_CHANNEL_SERVER_P2P && item->authId != AUTH_INVALID_ID &&
|
||||
!item->serverSide && item->appInfo.routeType != WIFI_P2P_REUSE && item->requestId != AUTH_INVALID_ID) {
|
||||
AuthCloseConn(item->authId);
|
||||
}
|
||||
ListDelete(&item->node);
|
||||
|
Loading…
Reference in New Issue
Block a user