hi3568 bind failed

Signed-off-by: xzh457 <xiaozihan4@h-partners.com>
Change-Id: I8bb51fffd73a18daa359d043b42c439a28782c31
This commit is contained in:
xzh457 2024-09-14 14:59:18 +08:00
parent 52076f7406
commit 3dcb5de8cb
2 changed files with 80 additions and 1 deletions

View File

@ -154,6 +154,50 @@ static void ServerReadSessionAttrs(IpcIo *req, SessionAttribute *getAttr)
}
}
static bool ReadQosInfo(IpcIo *req, SessionParam *param)
{
if (req == NULL || param == NULL) {
TRANS_LOGE(TRANS_CTRL, "param or req is NULL");
return false;
}
if (!ReadBool(req, &param->isQosLane)) {
TRANS_LOGE(TRANS_SDK, "read qos flag failed!");
return false;
}
if (!param->isQosLane) {
return true;
}
if (!ReadUint32(req, &param->qosCount)) {
TRANS_LOGE(TRANS_SDK, "read count of qos failed!");
return false;
}
if (param->qosCount == 0) {
return true;
}
if (param->qosCount > QOS_TYPE_BUTT) {
TRANS_LOGE(TRANS_SDK, "read invalid qosCount=%{public}" PRIu32, param->qosCount);
return false;
}
const QosTV *qosInfo = (QosTV *)ReadBuffer(req, sizeof(QosTV) * param->qosCount);
if (qosInfo == NULL) {
COMM_LOGE(COMM_SVC, "failed to read qos data");
return false;
}
if (memcpy_s(param->qos, sizeof(QosTV) * QOS_TYPE_BUTT, qosInfo, sizeof(QosTV) * param->qosCount) != EOK) {
COMM_LOGE(COMM_SVC, "failed memcpy qos info");
return false;
}
return true;
}
int32_t ServerOpenSession(IpcIo *req, IpcIo *reply)
{
TRANS_LOGI(TRANS_CTRL, "ipc server pop");
@ -179,6 +223,10 @@ int32_t ServerOpenSession(IpcIo *req, IpcIo *reply)
ReadInt32(req, &param.sessionId);
ServerReadSessionAttrs(req, &getAttr);
param.attr = &getAttr;
if (!ReadQosInfo(req, &param)) {
TRANS_LOGE(TRANS_CTRL, "failed to read qos info");
return SOFTBUS_IPC_ERR;
}
ret = CheckOpenSessionPremission(param.sessionName, param.peerSessionName);
if (ret != SOFTBUS_OK) {

View File

@ -59,6 +59,32 @@ static int OpenSessionProxyCallback(IOwner owner, int code, IpcIo *reply)
return SOFTBUS_OK;
}
static bool WriteQosInfo(IpcIo *request, const SessionParam *param)
{
if (!WriteBool(request, param->isQosLane)) {
TRANS_LOGE(TRANS_SDK, "OpenSession write qos flag failed!");
return false;
}
if (!param->isQosLane) {
return true;
}
if (!WriteUint32(request, param->qosCount)) {
TRANS_LOGE(TRANS_SDK, "OpenSession write count of qos failed!");
return false;
}
if (param->qosCount > 0) {
if (!WriteBuffer(request, param->qos, sizeof(QosTV) * param->qosCount)) {
TRANS_LOGE(TRANS_SDK, "OpenSession write qos info failed!");
return false;
}
}
return true;
}
int32_t TransServerProxyInit(void)
{
if (g_serverProxy != NULL) {
@ -154,7 +180,7 @@ int32_t ServerIpcRemoveSessionServer(const char *pkgName, const char *sessionNam
static bool TransWriteIpcSessionAttrs(IpcIo *request, const SessionAttribute *attrs)
{
if (attrs == NULL || request == NULL) {
TRANS_LOGE(TRANS_SDK, "attrs is nullptr!");
TRANS_LOGE(TRANS_SDK, "attrs is NULL!");
return false;
}
@ -216,6 +242,11 @@ int32_t ServerIpcOpenSession(const SessionParam *param, TransInfo *info)
return SOFTBUS_TRANS_PROXY_WRITERAWDATA_FAILED;
}
if (!WriteQosInfo(&request, param)) {
TRANS_LOGE(TRANS_SDK, "OpenSession write qosinfo failed!");
return SOFTBUS_TRANS_PROXY_WRITERAWDATA_FAILED;
}
TransSerializer transSerializer;
transSerializer.ret = SOFTBUS_NO_INIT;
/* sync */