mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-12-18 15:28:15 +00:00
!2656 [fixbug]在BR/BLE场景下 接受认证回调通知失败问题
Merge pull request !2656 from samuel.shi/master
This commit is contained in:
commit
de15b82a20
@ -173,7 +173,9 @@ int32_t ServerNotifyAuthSuccess(IpcIo *req, IpcIo *reply)
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
int32_t channelId = 0;
|
||||
int32_t channelType = -1;
|
||||
ReadInt32(req, &channelId);
|
||||
ReadInt32(req, &channelType);
|
||||
int32_t callingUid = GetCallingUid();
|
||||
int32_t callingPid = GetCallingPid();
|
||||
char pkgName[PKG_NAME_SIZE_MAX];
|
||||
@ -190,7 +192,7 @@ int32_t ServerNotifyAuthSuccess(IpcIo *req, IpcIo *reply)
|
||||
return SOFTBUS_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
int32_t ret = TransNotifyAuthSuccess(channelId);
|
||||
int32_t ret = TransNotifyAuthSuccess(channelId, channelType);
|
||||
WriteInt32(reply, ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
virtual int32_t RemoveSessionServer(const char *pkgName, const char *sessionName) = 0;
|
||||
virtual int32_t OpenSession(const SessionParam *param, TransInfo *info) = 0;
|
||||
virtual int32_t OpenAuthSession(const char *sessionName, const ConnectionAddr *addrInfo) = 0;
|
||||
virtual int32_t NotifyAuthSuccess(int channelId) = 0;
|
||||
virtual int32_t NotifyAuthSuccess(int32_t channelId, int32_t channelType) = 0;
|
||||
virtual int32_t CloseChannel(int32_t channelId, int32_t channelType) = 0;
|
||||
virtual int32_t SendMessage(int32_t channelId, int32_t channelType,
|
||||
const void *data, uint32_t len, int32_t msgType) = 0;
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
int32_t RemoveSessionServer(const char *pkgName, const char *sessionName) override;
|
||||
int32_t OpenSession(const SessionParam *param, TransInfo *info) override;
|
||||
int32_t OpenAuthSession(const char *sessionName, const ConnectionAddr *addrInfo) override;
|
||||
int32_t NotifyAuthSuccess(int32_t channelId) override;
|
||||
int32_t NotifyAuthSuccess(int32_t channelId, int32_t channelType) override;
|
||||
int32_t CloseChannel(int32_t channelId, int32_t channelType) override;
|
||||
int32_t SendMessage(int32_t channelId, int32_t channelType, const void *data,
|
||||
uint32_t len, int32_t msgType) override;
|
||||
|
@ -159,9 +159,9 @@ int32_t SoftBusServer::OpenAuthSession(const char *sessionName, const Connection
|
||||
return TransOpenAuthChannel(sessionName, &connOpt);
|
||||
}
|
||||
|
||||
int32_t SoftBusServer::NotifyAuthSuccess(int32_t channelId)
|
||||
int32_t SoftBusServer::NotifyAuthSuccess(int32_t channelId, int32_t channelType)
|
||||
{
|
||||
return TransNotifyAuthSuccess(channelId);
|
||||
return TransNotifyAuthSuccess(channelId, channelType);
|
||||
}
|
||||
|
||||
int32_t SoftBusServer::CloseChannel(int32_t channelId, int32_t channelType)
|
||||
|
@ -448,11 +448,16 @@ EXIT:
|
||||
int32_t SoftBusServerStub::NotifyAuthSuccessInner(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
int32_t channelId;
|
||||
int32_t channelType;
|
||||
if (!data.ReadInt32(channelId)) {
|
||||
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "NotifyAuthSuccessInner read channel Id failed!");
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
int32_t retReply = NotifyAuthSuccess(channelId);
|
||||
if (!data.ReadInt32(channelType)) {
|
||||
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "NotifyAuthSuccessInner read channel type failed!");
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
int32_t retReply = NotifyAuthSuccess(channelId, channelType);
|
||||
if (!reply.WriteInt32(retReply)) {
|
||||
SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "NotifyAuthSuccessInner write reply failed!");
|
||||
return SOFTBUS_ERR;
|
||||
|
@ -31,10 +31,12 @@ void TransAuthDeinit(void);
|
||||
int32_t TransAuthGetNameByChanId(int32_t chanId, char *pkgName, char *sessionName,
|
||||
uint16_t pkgLen, uint16_t sessionLen);
|
||||
int32_t TransOpenAuthMsgChannel(const char *sessionName, const ConnectOption *connOpt, int32_t *channedId);
|
||||
int32_t TransNotifyAuthDataSuccess(int32_t channelId);
|
||||
int32_t TransNotifyAuthDataSuccess(int32_t channelId, const ConnectOption *connOpt);
|
||||
int32_t TransCloseAuthChannel(int32_t channelId);
|
||||
int32_t TransSendAuthMsg(int32_t channelId, const char *msg, int32_t len);
|
||||
int32_t TransGetAuthAppInfoByChanId(int32_t channelId, AppInfo *appInfo);
|
||||
int32_t TransAuthGetAppInfoByChanId(int32_t channelId, AppInfo *appInfo);
|
||||
int32_t TransAuthGetConnOptionByChanId(int32_t channelId, ConnectOption *connOpt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
|
@ -700,24 +700,42 @@ int32_t TransSendAuthMsg(int32_t channelId, const char *data, int32_t len)
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
int32_t TransNotifyAuthDataSuccess(int32_t channelId)
|
||||
int32_t TransAuthGetConnOptionByChanId(int32_t channelId, ConnectOption *connOpt)
|
||||
{
|
||||
AuthChannelInfo chanInfo;
|
||||
if (GetAuthChannelInfoByChanId(channelId, &chanInfo) != SOFTBUS_OK) {
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "get auth channel info by chanid=%d fail", channelId);
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
|
||||
if (!chanInfo.isConnOptValid) {
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "auth channel of conn opt invalid");
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
|
||||
if (memcpy_s(connOpt, sizeof(ConnectOption), &(chanInfo.connOpt), sizeof(ConnectOption)) != EOK) {
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "auth channel connopt memcpy fail");
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
int32_t TransNotifyAuthDataSuccess(int32_t channelId, const ConnectOption *connOpt)
|
||||
{
|
||||
if (connOpt == NULL) {
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "%s invalid param.", __func__);
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
ConnectionAddr addr;
|
||||
(void)memset_s(&addr, sizeof(ConnectionAddr), 0, sizeof(ConnectionAddr));
|
||||
if (!LnnConvertOptionToAddr(&addr, &chanInfo.connOpt, CONNECTION_ADDR_WLAN)) {
|
||||
if (!LnnConvertOptionToAddr(&addr, connOpt, CONNECTION_ADDR_WLAN)) {
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "channel=%d convert addr fail.", channelId);
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
return LnnNotifyDiscoveryDevice(&addr);
|
||||
}
|
||||
|
||||
int32_t TransGetAuthAppInfoByChanId(int32_t channelId, AppInfo *appInfo)
|
||||
int32_t TransAuthGetAppInfoByChanId(int32_t channelId, AppInfo *appInfo)
|
||||
{
|
||||
if (appInfo == NULL || g_authChannelList == NULL) {
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
|
@ -40,7 +40,7 @@ int32_t TransRippleStats(int32_t channelId, int32_t channelType, const TrafficSt
|
||||
|
||||
int32_t TransRequestQos(int32_t channelId, int32_t chanType, int32_t appType, int32_t quality);
|
||||
|
||||
int32_t TransNotifyAuthSuccess(int32_t channelId);
|
||||
int32_t TransNotifyAuthSuccess(int32_t channelId, int32_t channelType);
|
||||
|
||||
int32_t TransCloseChannel(int32_t channelId, int32_t channelType);
|
||||
|
||||
|
@ -424,9 +424,27 @@ int32_t TransRippleStats(int32_t channelId, int32_t channelType, const TrafficSt
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
int32_t TransNotifyAuthSuccess(int32_t channelId)
|
||||
int32_t TransNotifyAuthSuccess(int32_t channelId, int32_t channelType)
|
||||
{
|
||||
return TransNotifyAuthDataSuccess(channelId);
|
||||
int32_t ret = SOFTBUS_ERR;
|
||||
ConnectOption connOpt;
|
||||
switch (channelType) {
|
||||
case CHANNEL_TYPE_AUTH:
|
||||
ret = TransAuthGetConnOptionByChanId(channelId, &connOpt);
|
||||
break;
|
||||
case CHANNEL_TYPE_PROXY:
|
||||
ret = TransProxyGetConnOptionByChanId(channelId, &connOpt);
|
||||
break;
|
||||
default:
|
||||
ret = SOFTBUS_ERR;
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "channel=%d, type=%d invalid.", channelId, channelType);
|
||||
}
|
||||
if (ret != SOFTBUS_OK) {
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR,
|
||||
"channel=%d, type=%d,notfiy auth success error=%d.", channelId, channelType, ret);
|
||||
return ret;
|
||||
}
|
||||
return TransNotifyAuthDataSuccess(channelId, &connOpt);
|
||||
}
|
||||
|
||||
int32_t TransCloseChannel(int32_t channelId, int32_t channelType)
|
||||
@ -504,7 +522,7 @@ int32_t TransGetAppInfoByChanId(int32_t channelId, int32_t channelType, AppInfo*
|
||||
case CHANNEL_TYPE_UDP:
|
||||
return TransGetUdpAppInfoByChannelId(channelId, appInfo);
|
||||
case CHANNEL_TYPE_AUTH:
|
||||
return TransGetAuthAppInfoByChanId(channelId, appInfo);
|
||||
return TransAuthGetAppInfoByChanId(channelId, appInfo);
|
||||
default:
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
|
@ -31,21 +31,30 @@ int32_t TransProxyGetNewChanSeq(int32_t channelId);
|
||||
int32_t TransProxyOpenProxyChannel(const AppInfo *appInfo, const ConnectOption *connInfo, int32_t *channelId);
|
||||
int32_t TransProxyCloseProxyChannel(int32_t channelId);
|
||||
int32_t TransProxySendMsg(int32_t channelId, const char *data, uint32_t dataLen, int32_t priority);
|
||||
|
||||
void TransProxyDelByConnId(uint32_t connId);
|
||||
void TransProxyDelChanByReqId(int32_t reqId);
|
||||
void TransProxyDelChanByChanId(int32_t chanlId);
|
||||
|
||||
void TransProxyOpenProxyChannelSuccess(int32_t chanId);
|
||||
void TransProxyOpenProxyChannelFail(int32_t channelId, const AppInfo *appInfo, int32_t errCode);
|
||||
void TransProxyonMessageReceived(const ProxyMessage *msg);
|
||||
|
||||
int32_t TransProxyGetSessionKeyByChanId(int32_t channelId, char *sessionKey, uint32_t sessionKeySize);
|
||||
int16_t TransProxyGetNewMyId(void);
|
||||
int32_t TransProxyGetSendMsgChanInfo(int32_t channelId, ProxyChannelInfo *chanInfo);
|
||||
void TransProxyDelChanByReqId(int32_t reqId);
|
||||
|
||||
int32_t TransProxyCreateChanInfo(ProxyChannelInfo *chan, int32_t channelId, const AppInfo *appInfo);
|
||||
void TransProxyChanProcessByReqId(int32_t reqId, uint32_t connId);
|
||||
void TransProxyDelChanByChanId(int32_t chanlId);
|
||||
|
||||
int64_t TransProxyGetAuthId(int32_t channelId);
|
||||
int32_t TransProxyGetNameByChanId(int32_t chanId, char *pkgName, char *sessionName,
|
||||
uint16_t pkgLen, uint16_t sessionLen);
|
||||
|
||||
void TransProxyDeathCallback(const char *pkgName, int32_t pid);
|
||||
|
||||
int32_t TransProxyGetAppInfoByChanId(int32_t chanId, AppInfo* appInfo);
|
||||
int32_t TransProxyGetConnIdByChanId(int32_t channelId, int32_t *connId);
|
||||
int32_t TransProxyGetConnOptionByChanId(int32_t channelId, ConnectOption *connOpt);
|
||||
|
||||
#endif
|
||||
|
@ -43,5 +43,6 @@ int32_t TransProxyTransSendMsg(uint32_t connectionId, uint8_t *buf, uint32_t len
|
||||
void TransCreateConnByConnId(uint32_t connId);
|
||||
int32_t TransDecConnRefByConnId(uint32_t connId);
|
||||
int32_t TransAddConnRefByConnId(uint32_t connId);
|
||||
int32_t TransProxyGetConnInfoByConnId(uint32_t connId, ConnectOption *connInfo);
|
||||
|
||||
#endif
|
||||
|
@ -1304,4 +1304,25 @@ int32_t TransProxyGetConnIdByChanId(int32_t channelId, int32_t *connId)
|
||||
(void)SoftBusMutexUnlock(&g_proxyChannelList->lock);
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
|
||||
|
||||
int32_t TransProxyGetConnOptionByChanId(int32_t channelId, ConnectOption *connOpt)
|
||||
{
|
||||
if (connOpt == NULL) {
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "[%s] invalid param.", __func__);
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
|
||||
int32_t connId = -1;
|
||||
int32_t ret = TransProxyGetConnIdByChanId(channelId, &connId);
|
||||
if (ret != SOFTBUS_OK) {
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "channel=%d get proxy connid fail, %d.", channelId, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = TransProxyGetConnInfoByConnId(connId, connOpt);
|
||||
if (ret != SOFTBUS_OK) {
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "channel=%d get conn optinfo fail, %d.", channelId, ret);
|
||||
return ret;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
@ -708,3 +708,38 @@ int32_t TransProxyTransInit(void)
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
int32_t TransProxyGetConnInfoByConnId(uint32_t connId, ConnectOption *connInfo)
|
||||
{
|
||||
if (connInfo == NULL) {
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "%s invalid param.", __func__);
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
|
||||
if (g_proxyConnectionList == NULL) {
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "proxy connect list empty.");
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
|
||||
if (SoftBusMutexLock(&g_proxyConnectionList->lock) != SOFTBUS_OK) {
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "lock mutex fail.");
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
|
||||
ProxyConnInfo *item = NULL;
|
||||
LIST_FOR_EACH_ENTRY(item, &g_proxyConnectionList->list, ProxyConnInfo, node) {
|
||||
if (item->connId == connId) {
|
||||
if (memcpy_s(connInfo, sizeof(ConnectOption), &(item->connInfo), sizeof(ConnectOption)) != EOK) {
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "id=%u proxy connoption memcpy failed.", connId);
|
||||
(void)SoftBusMutexUnlock(&g_proxyConnectionList->lock);
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
(void)SoftBusMutexUnlock(&g_proxyConnectionList->lock);
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
}
|
||||
(void)SoftBusMutexUnlock(&g_proxyConnectionList->lock);
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "id=%u proxy conn node not found.", connId);
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ static int32_t OpenAuthConn(const char *uuid, uint32_t reqId, bool isMeta)
|
||||
AuthConnInfo auth;
|
||||
(void)memset_s(&auth, sizeof(AuthConnInfo), 0, sizeof(AuthConnInfo));
|
||||
AuthConnCallback cb;
|
||||
(void)memset_s(&auth, sizeof(AuthConnCallback), 0, sizeof(AuthConnCallback));
|
||||
(void)memset_s(&cb, sizeof(AuthConnCallback), 0, sizeof(AuthConnCallback));
|
||||
|
||||
if (AuthGetPreferConnInfo(uuid, &auth, isMeta) != SOFTBUS_OK) {
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "OpenAuthConn get auth info fail");
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
int32_t CreateSessionServer(const char *pkgName, const char *sessionName) override;
|
||||
int32_t RemoveSessionServer(const char *pkgName, const char *sessionName) override;
|
||||
int32_t OpenSession(const SessionParam *param, TransInfo *info) override;
|
||||
int32_t NotifyAuthSuccess(int channelId) override;
|
||||
int32_t NotifyAuthSuccess(int32_t channelId, int32_t channelType) override;
|
||||
int32_t OpenAuthSession(const char *sessionName, const ConnectionAddr *addrInfo) override;
|
||||
int32_t CloseChannel(int32_t channelId, int32_t channelType) override;
|
||||
int32_t SendMessage(int32_t channelId, int32_t channelType, const void *data,
|
||||
|
@ -96,8 +96,10 @@ int32_t BusCenterServerProxy::OpenAuthSession(const char *sessionName, const Con
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
int32_t BusCenterServerProxy::NotifyAuthSuccess(int channelId)
|
||||
int32_t BusCenterServerProxy::NotifyAuthSuccess(int32_t channelId, int32_t channelType)
|
||||
{
|
||||
(void)channelId;
|
||||
(void)channelType;
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
int32_t CreateSessionServer(const char *pkgName, const char *sessionName) override;
|
||||
int32_t RemoveSessionServer(const char *pkgName, const char *sessionName) override;
|
||||
int32_t OpenSession(const SessionParam *param, TransInfo *info) override;
|
||||
int32_t NotifyAuthSuccess(int32_t channelId) override;
|
||||
int32_t NotifyAuthSuccess(int32_t channelId, int32_t channelType) override;
|
||||
int32_t OpenAuthSession(const char *sessionName, const ConnectionAddr *addrInfo) override;
|
||||
int32_t CloseChannel(int32_t channelId, int32_t channelType) override;
|
||||
int32_t SendMessage(int32_t channelId, int32_t channelType, const void *data,
|
||||
|
@ -228,9 +228,10 @@ int32_t DiscServerProxy::OpenAuthSession(const char *sessionName, const Connecti
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
int32_t DiscServerProxy::NotifyAuthSuccess(int32_t channelId)
|
||||
int32_t DiscServerProxy::NotifyAuthSuccess(int32_t channelId, int32_t channelType)
|
||||
{
|
||||
(void)channelId;
|
||||
(void)channelType;
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
int32_t RemoveSessionServer(const char *pkgName, const char *sessionName) override;
|
||||
int32_t OpenSession(const SessionParam *param, TransInfo *info) override;
|
||||
int32_t OpenAuthSession(const char *sessionName, const ConnectionAddr *addrInfo) override;
|
||||
int32_t NotifyAuthSuccess(int32_t channelId) override;
|
||||
int32_t NotifyAuthSuccess(int32_t channelId, int32_t channelType) override;
|
||||
int32_t CloseChannel(int32_t channelId, int32_t channelType) override;
|
||||
int32_t SendMessage(int32_t channelId, int32_t channelType, const void *data,
|
||||
uint32_t len, int32_t msgType) override;
|
||||
|
@ -137,9 +137,10 @@ int32_t SoftBusServerProxyFrame::OpenAuthSession(const char *sessionName, const
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
int32_t SoftBusServerProxyFrame::NotifyAuthSuccess(int32_t channelId)
|
||||
int32_t SoftBusServerProxyFrame::NotifyAuthSuccess(int32_t channelId, int32_t channelType)
|
||||
{
|
||||
(void)channelId;
|
||||
(void)channelType;
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ int32_t ServerIpcCreateSessionServer(const char *pkgName, const char *sessionNam
|
||||
int32_t ServerIpcRemoveSessionServer(const char *pkgName, const char *sessionName);
|
||||
int32_t ServerIpcOpenSession(const SessionParam *param, TransInfo *info);
|
||||
int32_t ServerIpcOpenAuthSession(const char *sessionName, const ConnectionAddr *addrInfo);
|
||||
int32_t ServerIpcNotifyAuthSuccess(int channelId);
|
||||
int32_t ServerIpcNotifyAuthSuccess(int32_t channelId, int32_t channelType);
|
||||
int32_t ServerIpcCloseChannel(int32_t channelId, int32_t channelType);
|
||||
int32_t ServerIpcSendMessage(int32_t channelId, int32_t channelType, const void *data, uint32_t len, int32_t msgType);
|
||||
int32_t ServerIpcQosReport(int32_t channelId, int32_t chanType, int32_t appType, int32_t quality);
|
||||
|
@ -60,9 +60,9 @@ int32_t ServerIpcOpenAuthSession(const char *sessionName, const ConnectionAddr *
|
||||
return TransOpenAuthChannel(sessionName, &connOpt);
|
||||
}
|
||||
|
||||
int32_t ServerIpcNotifyAuthSuccess(int channelId)
|
||||
int32_t ServerIpcNotifyAuthSuccess(int32_t channelId, int32_t channelType)
|
||||
{
|
||||
return TransNotifyAuthSuccess(channelId);
|
||||
return TransNotifyAuthSuccess(channelId, channelType);
|
||||
}
|
||||
|
||||
int32_t ServerIpcCloseChannel(int32_t channelId, int32_t channelType)
|
||||
|
@ -216,7 +216,7 @@ int32_t ServerIpcOpenAuthSession(const char *sessionName, const ConnectionAddr *
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t ServerIpcNotifyAuthSuccess(int channelId)
|
||||
int32_t ServerIpcNotifyAuthSuccess(int32_t channelId, int32_t channelType)
|
||||
{
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_INFO, "ServerIpcNotifyAuthSuccess begin");
|
||||
|
||||
@ -224,6 +224,7 @@ int32_t ServerIpcNotifyAuthSuccess(int channelId)
|
||||
IpcIo request = {0};
|
||||
IpcIoInit(&request, data, MAX_SOFT_BUS_IPC_LEN, 0);
|
||||
WriteInt32(&request, channelId);
|
||||
WriteInt32(&request, channelType);
|
||||
int32_t ret = SOFTBUS_ERR;
|
||||
if (g_serverProxy == NULL) {
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "server proxy not init");
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
int32_t RemoveSessionServer(const char *pkgName, const char *sessionName) override;
|
||||
int32_t OpenSession(const SessionParam *param, TransInfo *info) override;
|
||||
int32_t OpenAuthSession(const char *sessionName, const ConnectionAddr *addrInfo) override;
|
||||
int32_t NotifyAuthSuccess(int32_t channelId) override;
|
||||
int32_t NotifyAuthSuccess(int32_t channelId, int32_t channelType) override;
|
||||
int32_t CloseChannel(int32_t channelId, int32_t channelType) override;
|
||||
int32_t SendMessage(int32_t channelId, int32_t channelType, const void *data,
|
||||
uint32_t len, int32_t msgType) override;
|
||||
|
@ -76,7 +76,9 @@ int32_t TransServerProxyInit(void)
|
||||
|
||||
void TransServerProxyDeInit(void)
|
||||
{
|
||||
delete g_serverProxy;
|
||||
if (g_serverProxy != nullptr) {
|
||||
delete g_serverProxy;
|
||||
}
|
||||
g_serverProxy = nullptr;
|
||||
}
|
||||
|
||||
@ -143,9 +145,9 @@ int32_t ServerIpcOpenAuthSession(const char *sessionName, const ConnectionAddr *
|
||||
return channelId;
|
||||
}
|
||||
|
||||
int32_t ServerIpcNotifyAuthSuccess(int channelId)
|
||||
int32_t ServerIpcNotifyAuthSuccess(int32_t channelId, int32_t channelType)
|
||||
{
|
||||
return g_serverProxy->NotifyAuthSuccess(channelId);
|
||||
return g_serverProxy->NotifyAuthSuccess(channelId, channelType);
|
||||
}
|
||||
|
||||
int32_t ServerIpcCloseChannel(int32_t channelId, int32_t channelType)
|
||||
|
@ -251,7 +251,7 @@ int32_t TransServerProxy::OpenAuthSession(const char *sessionName, const Connect
|
||||
return channelId;
|
||||
}
|
||||
|
||||
int32_t TransServerProxy::NotifyAuthSuccess(int channelId)
|
||||
int32_t TransServerProxy::NotifyAuthSuccess(int32_t channelId, int32_t channelType)
|
||||
{
|
||||
sptr<IRemoteObject> remote = GetSystemAbility();
|
||||
if (remote == nullptr) {
|
||||
@ -267,6 +267,10 @@ int32_t TransServerProxy::NotifyAuthSuccess(int channelId)
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "ServerIpcNotifyAuthSuccess write channel id failed!");
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
if (!data.WriteInt32(channelType)) {
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "ServerIpcNotifyAuthSuccess write channel type failed!");
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
|
@ -348,12 +348,12 @@ int OpenAuthSession(const char *sessionName, const ConnectionAddr *addrInfo, int
|
||||
|
||||
void NotifyAuthSuccess(int sessionId)
|
||||
{
|
||||
int32_t channelId;
|
||||
int32_t type;
|
||||
int32_t channelId = -1;
|
||||
int32_t channelType = -1;
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_INFO, "NotifyAuthSuccess sessionId:%d", sessionId);
|
||||
int32_t ret = ClientGetChannelBySessionId(sessionId, &channelId, &type, NULL);
|
||||
int32_t ret = ClientGetChannelBySessionId(sessionId, &channelId, &channelType, NULL);
|
||||
if (ret != SOFTBUS_OK) {
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "get channel err");
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "get session=%d channel err, ret:%d.", sessionId, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -368,8 +368,9 @@ void NotifyAuthSuccess(int sessionId)
|
||||
}
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_INFO, "device is client side");
|
||||
|
||||
if (ServerIpcNotifyAuthSuccess(channelId) != SOFTBUS_OK) {
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "ServerIpcNotifyAuthSuccess err");
|
||||
if (ServerIpcNotifyAuthSuccess(channelId, channelType) != SOFTBUS_OK) {
|
||||
SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR,
|
||||
"channel=%d type=%d ServerIpcNotifyAuthSuccess err", channelId, channelType);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user