mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-11-27 02:40:40 +00:00
fix:Rectification softbus_err
Signed-off-by: wangwang16 <wangwang16@huawei.com>
This commit is contained in:
parent
2d6f0ec20b
commit
07bc8f2ad1
@ -41,12 +41,12 @@ int32_t ServerCreateSessionServer(IpcIo *req, IpcIo *reply)
|
|||||||
const char *pkgName = (const char*)ReadString(req, &size);
|
const char *pkgName = (const char*)ReadString(req, &size);
|
||||||
if (pkgName == NULL) {
|
if (pkgName == NULL) {
|
||||||
TRANS_LOGE(TRANS_CTRL, "ServerCreateSessionServer pkgName is null");
|
TRANS_LOGE(TRANS_CTRL, "ServerCreateSessionServer pkgName is null");
|
||||||
return SOFTBUS_ERR;
|
return SOFTBUS_NO_INIT;
|
||||||
}
|
}
|
||||||
const char *sessionName = (const char *)ReadString(req, &size);
|
const char *sessionName = (const char *)ReadString(req, &size);
|
||||||
if (sessionName == NULL) {
|
if (sessionName == NULL) {
|
||||||
TRANS_LOGE(TRANS_CTRL, "sessionName pkgName is null");
|
TRANS_LOGE(TRANS_CTRL, "sessionName pkgName is null");
|
||||||
return SOFTBUS_ERR;
|
return SOFTBUS_NO_INIT;
|
||||||
}
|
}
|
||||||
int32_t callingUid = GetCallingUid();
|
int32_t callingUid = GetCallingUid();
|
||||||
int32_t callingPid = GetCallingPid();
|
int32_t callingPid = GetCallingPid();
|
||||||
@ -71,12 +71,12 @@ int32_t ServerRemoveSessionServer(IpcIo *req, IpcIo *reply)
|
|||||||
const char *pkgName = (const char*)ReadString(req, &size);
|
const char *pkgName = (const char*)ReadString(req, &size);
|
||||||
if (pkgName == NULL) {
|
if (pkgName == NULL) {
|
||||||
TRANS_LOGE(TRANS_CTRL, "ServerRemoveSessionServer pkgName is null");
|
TRANS_LOGE(TRANS_CTRL, "ServerRemoveSessionServer pkgName is null");
|
||||||
return SOFTBUS_ERR;
|
return SOFTBUS_NO_INIT;
|
||||||
}
|
}
|
||||||
const char *sessionName = (const char *)ReadString(req, &size);
|
const char *sessionName = (const char *)ReadString(req, &size);
|
||||||
if (sessionName == NULL) {
|
if (sessionName == NULL) {
|
||||||
TRANS_LOGE(TRANS_CTRL, "ServerRemoveSessionServer sessionName is null");
|
TRANS_LOGE(TRANS_CTRL, "ServerRemoveSessionServer sessionName is null");
|
||||||
return SOFTBUS_ERR;
|
return SOFTBUS_NO_INIT;
|
||||||
}
|
}
|
||||||
int32_t callingUid = GetCallingUid();
|
int32_t callingUid = GetCallingUid();
|
||||||
int32_t callingPid = GetCallingPid();
|
int32_t callingPid = GetCallingPid();
|
||||||
@ -234,7 +234,7 @@ int32_t ServerOpenSession(IpcIo *req, IpcIo *reply)
|
|||||||
WriteUint32(reply, sizeof(TransSerializer));
|
WriteUint32(reply, sizeof(TransSerializer));
|
||||||
bool value = WriteBuffer(reply, (void *)&transSerializer, sizeof(TransSerializer));
|
bool value = WriteBuffer(reply, (void *)&transSerializer, sizeof(TransSerializer));
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return SOFTBUS_ERR;
|
return SOFTBUS_MALLOC_ERR;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ int32_t ServerOpenSession(IpcIo *req, IpcIo *reply)
|
|||||||
WriteUint32(reply, sizeof(TransSerializer));
|
WriteUint32(reply, sizeof(TransSerializer));
|
||||||
bool value = WriteBuffer(reply, (void *)&transSerializer, sizeof(TransSerializer));
|
bool value = WriteBuffer(reply, (void *)&transSerializer, sizeof(TransSerializer));
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return SOFTBUS_ERR;
|
return SOFTBUS_MALLOC_ERR;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -263,8 +263,8 @@ int32_t ServerOpenAuthSession(IpcIo *req, IpcIo *reply)
|
|||||||
ConnectionAddr *addr = (ConnectionAddr *)ReadRawData(req, sizeof(ConnectionAddr));
|
ConnectionAddr *addr = (ConnectionAddr *)ReadRawData(req, sizeof(ConnectionAddr));
|
||||||
if (!LnnConvertAddrToOption(addr, &connOpt)) {
|
if (!LnnConvertAddrToOption(addr, &connOpt)) {
|
||||||
TRANS_LOGE(TRANS_CTRL, "LnnConvertAddrToOption fail");
|
TRANS_LOGE(TRANS_CTRL, "LnnConvertAddrToOption fail");
|
||||||
WriteInt32(reply, SOFTBUS_ERR);
|
WriteInt32(reply, SOFTBUS_NO_INIT);
|
||||||
return SOFTBUS_ERR;
|
return SOFTBUS_NO_INIT;
|
||||||
}
|
}
|
||||||
ret = CheckOpenSessionPremission(sessionName, sessionName);
|
ret = CheckOpenSessionPremission(sessionName, sessionName);
|
||||||
if (ret != SOFTBUS_OK) {
|
if (ret != SOFTBUS_OK) {
|
||||||
|
@ -72,7 +72,7 @@ int32_t SoftBusServer::SoftbusRegisterService(const char *clientPkgName, const s
|
|||||||
sptr<IRemoteObject::DeathRecipient> abilityDeath = new (std::nothrow) SoftBusDeathRecipient();
|
sptr<IRemoteObject::DeathRecipient> abilityDeath = new (std::nothrow) SoftBusDeathRecipient();
|
||||||
if (abilityDeath == nullptr) {
|
if (abilityDeath == nullptr) {
|
||||||
COMM_LOGE(COMM_SVC, "DeathRecipient object is nullptr");
|
COMM_LOGE(COMM_SVC, "DeathRecipient object is nullptr");
|
||||||
return SOFTBUS_TRANS_DEATH_RECIPIENT_IS_NULL;
|
return SOFTBUS_TRANS_DEATH_RECIPIENT_INVALID;
|
||||||
}
|
}
|
||||||
bool ret = object->AddDeathRecipient(abilityDeath);
|
bool ret = object->AddDeathRecipient(abilityDeath);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
|
@ -35,7 +35,6 @@ typedef struct {
|
|||||||
* @param[in] channelId indicates that channel is open.
|
* @param[in] channelId indicates that channel is open.
|
||||||
* @param[in] uuid indicates the pointer to the uuid.
|
* @param[in] uuid indicates the pointer to the uuid.
|
||||||
* @param[in] isServer indicates server side or client side.
|
* @param[in] isServer indicates server side or client side.
|
||||||
* @return <b>SOFTBUS_ERR</b> the processing failed after the callback.
|
|
||||||
* @return <b>SOFTBUS_OK</b> the processing success after the callback.
|
* @return <b>SOFTBUS_OK</b> the processing success after the callback.
|
||||||
*/
|
*/
|
||||||
int (*onChannelOpened)(int32_t channelId, const char *uuid, unsigned char isServer);
|
int (*onChannelOpened)(int32_t channelId, const char *uuid, unsigned char isServer);
|
||||||
@ -104,7 +103,6 @@ int TransSendNetworkingMessage(int32_t channelId, const char *data, uint32_t dat
|
|||||||
* this interface is current only called once when the sync info manager.
|
* this interface is current only called once when the sync info manager.
|
||||||
* @see {@link INetworkingListener}
|
* @see {@link INetworkingListener}
|
||||||
* @param[in] listener indicates regiestered function callback.
|
* @param[in] listener indicates regiestered function callback.
|
||||||
* @return <b>SOFTBUS_ERR</b> Failed to add listener to channel listener manager.
|
|
||||||
* @return <b>SOFTBUS_OK</b> Success to register channel listener, return other internal errorcodes otherwise.
|
* @return <b>SOFTBUS_OK</b> Success to register channel listener, return other internal errorcodes otherwise.
|
||||||
*/
|
*/
|
||||||
int TransRegisterNetworkingChannelListener(const char *sessionName, const INetworkingListener *listener);
|
int TransRegisterNetworkingChannelListener(const char *sessionName, const INetworkingListener *listener);
|
||||||
|
@ -86,7 +86,7 @@ static void GetProxyChannelInfo(int32_t channelId, const AppInfo *appInfo, bool
|
|||||||
static int32_t NotifyNormalChannelOpened(int32_t channelId, const AppInfo *appInfo, bool isServer)
|
static int32_t NotifyNormalChannelOpened(int32_t channelId, const AppInfo *appInfo, bool isServer)
|
||||||
{
|
{
|
||||||
ChannelInfo info = {0};
|
ChannelInfo info = {0};
|
||||||
int32_t ret = SOFTBUS_ERR;
|
int32_t ret;
|
||||||
char buf[NETWORK_ID_BUF_LEN] = {0};
|
char buf[NETWORK_ID_BUF_LEN] = {0};
|
||||||
|
|
||||||
GetProxyChannelInfo(channelId, appInfo, isServer, &info);
|
GetProxyChannelInfo(channelId, appInfo, isServer, &info);
|
||||||
|
@ -560,7 +560,7 @@ static void OpenNetWorkingChannel(int32_t requestId, ITransProxyPipelineCallback
|
|||||||
g_manager.channels->cnt -= 1;
|
g_manager.channels->cnt -= 1;
|
||||||
SoftBusFree(target);
|
SoftBusFree(target);
|
||||||
(void)SoftBusMutexUnlock(&g_manager.channels->lock);
|
(void)SoftBusMutexUnlock(&g_manager.channels->lock);
|
||||||
callback->onChannelOpenFailed(requestId, SOFTBUS_ERR);
|
callback->onChannelOpenFailed(requestId, INVALID_CHANNEL_ID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
target->channelId = channelId;
|
target->channelId = channelId;
|
||||||
|
@ -777,7 +777,7 @@ int32_t TransProxyOpenConnChannel(const AppInfo *appInfo, const ConnectOption *c
|
|||||||
TRANS_LOGE(TRANS_CTRL, "invalid param");
|
TRANS_LOGE(TRANS_CTRL, "invalid param");
|
||||||
return SOFTBUS_INVALID_PARAM;
|
return SOFTBUS_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
int32_t ret = SOFTBUS_ERR;
|
int32_t ret;
|
||||||
ProxyConnInfo conn;
|
ProxyConnInfo conn;
|
||||||
int32_t chanNewId = GenerateChannelId(false);
|
int32_t chanNewId = GenerateChannelId(false);
|
||||||
if (chanNewId <= INVALID_CHANNEL_ID) {
|
if (chanNewId <= INVALID_CHANNEL_ID) {
|
||||||
|
@ -68,7 +68,6 @@ extern "C" {
|
|||||||
* @return Returns <b>SOFTBUS_OK</b> if the operation is successful.
|
* @return Returns <b>SOFTBUS_OK</b> if the operation is successful.
|
||||||
* @return Returns <b>SOFTBUS_INVALID_PARAM</b> if invalid parameters are detected.
|
* @return Returns <b>SOFTBUS_INVALID_PARAM</b> if invalid parameters are detected.
|
||||||
* @return Returns <b>SOFTBUS_TRANS_FUNC_NOT_SUPPORT</b> if the session ID is not supported.
|
* @return Returns <b>SOFTBUS_TRANS_FUNC_NOT_SUPPORT</b> if the session ID is not supported.
|
||||||
* @return Returns <b>SOFTBUS_ERR</b> if an error occurs in the internal processing of DSoftBus.
|
|
||||||
* @return Returns <b>SOFTBUS_MEM_ERR</b> if the operation fails due to insufficient memory.
|
* @return Returns <b>SOFTBUS_MEM_ERR</b> if the operation fails due to insufficient memory.
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
@ -84,7 +83,6 @@ int32_t GetSessionKey(int32_t sessionId, char *key, unsigned int len);
|
|||||||
* @return Returns <b>SOFTBUS_OK</b> if the operation is successful.
|
* @return Returns <b>SOFTBUS_OK</b> if the operation is successful.
|
||||||
* @return Returns <b>SOFTBUS_INVALID_PARAM</b> if invalid parameters are detected.
|
* @return Returns <b>SOFTBUS_INVALID_PARAM</b> if invalid parameters are detected.
|
||||||
* @return Returns <b>SOFTBUS_TRANS_FUNC_NOT_SUPPORT</b> if the session ID is not supported.
|
* @return Returns <b>SOFTBUS_TRANS_FUNC_NOT_SUPPORT</b> if the session ID is not supported.
|
||||||
* @return Returns <b>SOFTBUS_ERR</b> if an error occurs in the internal processing of DSoftBus.
|
|
||||||
* @return Returns <b>SOFTBUS_MEM_ERR</b> if the operation fails due to insufficient memory.
|
* @return Returns <b>SOFTBUS_MEM_ERR</b> if the operation fails due to insufficient memory.
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
@ -99,7 +97,6 @@ int32_t GetSessionHandle(int32_t sessionId, int *handle);
|
|||||||
* @return Returns <b>SOFTBUS_OK</b> if the operation is successful.
|
* @return Returns <b>SOFTBUS_OK</b> if the operation is successful.
|
||||||
* @return Returns <b>SOFTBUS_INVALID_PARAM</b> if invalid parameters are detected.
|
* @return Returns <b>SOFTBUS_INVALID_PARAM</b> if invalid parameters are detected.
|
||||||
* @return Returns <b>SOFTBUS_TRANS_FUNC_NOT_SUPPORT</b> if the session ID is not supported.
|
* @return Returns <b>SOFTBUS_TRANS_FUNC_NOT_SUPPORT</b> if the session ID is not supported.
|
||||||
* @return Returns <b>SOFTBUS_ERR</b> if an error occurs in the internal processing of DSoftBus.
|
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
@ -369,18 +369,18 @@ enum SoftBusErrNo {
|
|||||||
SOFTBUS_TRANS_CREATE_SOCKET_SERVER_FAILED,
|
SOFTBUS_TRANS_CREATE_SOCKET_SERVER_FAILED,
|
||||||
SOFTBUS_TRANS_BUSINESSID_COUNT_FAILED,
|
SOFTBUS_TRANS_BUSINESSID_COUNT_FAILED,
|
||||||
SOFTBUS_TRANS_ON_CONNECT_REQUEST_IS_NULL,
|
SOFTBUS_TRANS_ON_CONNECT_REQUEST_IS_NULL,
|
||||||
SOFTBUS_TRANS_ON_SOCKET_OPENED_IS_NULL,
|
SOFTBUS_TRANS_ON_SOCKET_OPENED_INVALID,
|
||||||
SOFTBUS_TRANS_ON_SOCKET_REQUEST_IS_NULL,
|
SOFTBUS_TRANS_ON_SOCKET_REQUEST_INVALID,
|
||||||
SOFTBUS_TRANS_ON_SOCKET_CLOSED_IS_NULL,
|
SOFTBUS_TRANS_ON_SOCKET_CLOSED_INVALID,
|
||||||
SOFTBUS_TRANS_ON_DATA_RECEIVED_IS_NULL,
|
SOFTBUS_TRANS_ON_DATA_RECEIVED_INVALID,
|
||||||
SOFTBUS_TRANS_ON_PREDATA_REQUEST_IS_NULL,
|
SOFTBUS_TRANS_ON_PREDATA_REQUEST_INVALID,
|
||||||
SOFTBUS_TRANS_ON_SERVICE_REQUEST_IS_NULL,
|
SOFTBUS_TRANS_ON_SERVICE_REQUEST_INVALID,
|
||||||
SOFTBUS_TRANS_ON_SESSION_REQUEST_IS_NULL,
|
SOFTBUS_TRANS_ON_SESSION_REQUEST_INVALID,
|
||||||
SOFTBUS_TRANS_ON_SESSION_OPENED_IS_NULL,
|
SOFTBUS_TRANS_ON_SESSION_OPENED_INVALID,
|
||||||
SOFTBUS_TRANS_ON_SESSION_CLOSED_IS_NULL,
|
SOFTBUS_TRANS_ON_SESSION_CLOSED_INVALID,
|
||||||
SOFTBUS_TRANS_CREATE_LISTENER_MODULE_FAILED,
|
SOFTBUS_TRANS_CREATE_LISTENER_MODULE_FAILED,
|
||||||
SOFTBUS_TRANS_FILE_SCHEMA_LISTENER_FAILED,
|
SOFTBUS_TRANS_FILE_SCHEMA_LISTENER_FAILED,
|
||||||
SOFTBUS_TRANS_DEATH_RECIPIENT_IS_NULL,
|
SOFTBUS_TRANS_DEATH_RECIPIENT_INVALID,
|
||||||
SOFTBUS_TRANS_ADD_DEATH_RECIPIENT_FAILED,
|
SOFTBUS_TRANS_ADD_DEATH_RECIPIENT_FAILED,
|
||||||
SOFTBUS_TRANS_ON_CHANNEL_REQ_CALLBACK_FAILED,
|
SOFTBUS_TRANS_ON_CHANNEL_REQ_CALLBACK_FAILED,
|
||||||
SOFTBUS_TRANS_ON_SERVICE_REQ_CALLBACK_FAILED,
|
SOFTBUS_TRANS_ON_SERVICE_REQ_CALLBACK_FAILED,
|
||||||
|
@ -42,7 +42,7 @@ int32_t ClientOnChannelOpened(IpcIo *data, IpcIo *reply)
|
|||||||
if (channel.groupId == NULL || channel.sessionKey == NULL || channel.peerSessionName == NULL ||
|
if (channel.groupId == NULL || channel.sessionKey == NULL || channel.peerSessionName == NULL ||
|
||||||
channel.peerDeviceId == NULL) {
|
channel.peerDeviceId == NULL) {
|
||||||
TRANS_LOGE(TRANS_CTRL, "pointer null error.");
|
TRANS_LOGE(TRANS_CTRL, "pointer null error.");
|
||||||
return SOFTBUS_ERR;
|
return SOFTBUS_NO_INIT;
|
||||||
}
|
}
|
||||||
if (channel.channelType == CHANNEL_TYPE_TCP_DIRECT) {
|
if (channel.channelType == CHANNEL_TYPE_TCP_DIRECT) {
|
||||||
channel.myIp = (char *)ReadString(data, &size);
|
channel.myIp = (char *)ReadString(data, &size);
|
||||||
@ -57,7 +57,7 @@ int32_t ClientOnChannelOpened(IpcIo *data, IpcIo *reply)
|
|||||||
if (channel.isServer) {
|
if (channel.isServer) {
|
||||||
int32_t udpPort = TransOnChannelOpened(sessionName, &channel);
|
int32_t udpPort = TransOnChannelOpened(sessionName, &channel);
|
||||||
WriteInt32(reply, udpPort);
|
WriteInt32(reply, udpPort);
|
||||||
return SOFTBUS_ERR;
|
return SOFTBUS_TRANS_CHANNEL_OPEN_FAILED;
|
||||||
}
|
}
|
||||||
ReadInt32(data, &(channel.peerPort));
|
ReadInt32(data, &(channel.peerPort));
|
||||||
channel.peerIp = (char *)ReadString(data, &size);
|
channel.peerIp = (char *)ReadString(data, &size);
|
||||||
|
@ -140,7 +140,7 @@ static int32_t ServerProxyInit(void)
|
|||||||
OHOS::sptr<OHOS::IRemoteObject::DeathRecipient>(new (std::nothrow) OHOS::SoftBusClientDeathRecipient());
|
OHOS::sptr<OHOS::IRemoteObject::DeathRecipient>(new (std::nothrow) OHOS::SoftBusClientDeathRecipient());
|
||||||
if (g_clientDeath == nullptr) {
|
if (g_clientDeath == nullptr) {
|
||||||
COMM_LOGE(COMM_SDK, "DeathRecipient object is nullptr");
|
COMM_LOGE(COMM_SDK, "DeathRecipient object is nullptr");
|
||||||
return SOFTBUS_TRANS_DEATH_RECIPIENT_IS_NULL;
|
return SOFTBUS_TRANS_DEATH_RECIPIENT_INVALID;
|
||||||
}
|
}
|
||||||
if (!g_serverProxy->AddDeathRecipient(g_clientDeath)) {
|
if (!g_serverProxy->AddDeathRecipient(g_clientDeath)) {
|
||||||
COMM_LOGE(COMM_SDK, "AddDeathRecipient failed");
|
COMM_LOGE(COMM_SDK, "AddDeathRecipient failed");
|
||||||
|
@ -159,7 +159,9 @@ int32_t ClientAddNewSession(const char *sessionName, SessionInfo *session);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add session.
|
* @brief Add session.
|
||||||
* @return if session already added, return SOFTBUS_TRANS_SESSION_REPEATED, else return SOFTBUS_OK or SOFTBUS_ERR.
|
* @return if the operation is successful, return SOFTBUS_OK.
|
||||||
|
* @return if session already added, return SOFTBUS_TRANS_SESSION_REPEATED.
|
||||||
|
* @return return other error codes.
|
||||||
*/
|
*/
|
||||||
int32_t ClientAddSession(const SessionParam *param, int32_t *sessionId, SessionEnableStatus *isEnabled);
|
int32_t ClientAddSession(const SessionParam *param, int32_t *sessionId, SessionEnableStatus *isEnabled);
|
||||||
|
|
||||||
|
@ -497,8 +497,8 @@ HWTEST_F(LNNTransLaneMockTest, ALLOC_RAW_LANE_TEST_001, TestSize.Level1)
|
|||||||
EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
|
EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
|
||||||
ret = UpdateReqListLaneId(LANE_REQ_ID, NEW_LANE_REQ_ID);
|
ret = UpdateReqListLaneId(LANE_REQ_ID, NEW_LANE_REQ_ID);
|
||||||
EXPECT_EQ(ret, SOFTBUS_LOCK_ERR);
|
EXPECT_EQ(ret, SOFTBUS_LOCK_ERR);
|
||||||
NotifyFreeLaneResult(LANE_REQ_ID, SOFTBUS_ERR);
|
NotifyFreeLaneResult(LANE_REQ_ID, SOFTBUS_LOCK_ERR);
|
||||||
NotifyFreeLaneResult(NEW_LANE_REQ_ID, SOFTBUS_ERR);
|
NotifyFreeLaneResult(NEW_LANE_REQ_ID, SOFTBUS_LOCK_ERR);
|
||||||
transObj->deinit();
|
transObj->deinit();
|
||||||
}
|
}
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
@ -66,7 +66,7 @@ int32_t LnnTransInterfaceMock::ActionOfTransRegister(const INetworkingListener *
|
|||||||
{
|
{
|
||||||
if (listener == NULL) {
|
if (listener == NULL) {
|
||||||
LNN_LOGE(LNN_TEST, "listener is invalid para");
|
LNN_LOGE(LNN_TEST, "listener is invalid para");
|
||||||
return SOFTBUS_ERR;
|
return SOFTBUS_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
g_networkListener = listener;
|
g_networkListener = listener;
|
||||||
return SOFTBUS_OK;
|
return SOFTBUS_OK;
|
||||||
|
Loading…
Reference in New Issue
Block a user