mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-11-23 16:59:54 +00:00
fix: Increase the priority of send bytes
Signed-off-by: byx0010 <baiyuxin3@huawei.com>
This commit is contained in:
parent
6c06fe4886
commit
2204efe465
@ -381,6 +381,7 @@
|
|||||||
"ClientGetSessionCallbackAdapterByName";
|
"ClientGetSessionCallbackAdapterByName";
|
||||||
"ClientGetSessionCallbackAdapterById";
|
"ClientGetSessionCallbackAdapterById";
|
||||||
"ClientGetPeerSocketInfoById";
|
"ClientGetPeerSocketInfoById";
|
||||||
|
"ClientGetSessionNameByChannelId";
|
||||||
"TransSetSocketFileListener";
|
"TransSetSocketFileListener";
|
||||||
"EvaluateQos";
|
"EvaluateQos";
|
||||||
"GetMtuSize";
|
"GetMtuSize";
|
||||||
@ -487,4 +488,4 @@
|
|||||||
};
|
};
|
||||||
local:
|
local:
|
||||||
*;
|
*;
|
||||||
};
|
};
|
||||||
|
@ -177,6 +177,8 @@ int32_t ClientGetPeerSocketInfoById(int32_t sessionId, PeerSocketInfo *peerSocke
|
|||||||
bool IsSessionExceedLimit();
|
bool IsSessionExceedLimit();
|
||||||
|
|
||||||
int32_t ClientResetIdleTimeoutById(int32_t sessionId);
|
int32_t ClientResetIdleTimeoutById(int32_t sessionId);
|
||||||
|
|
||||||
|
int32_t ClientGetSessionNameByChannelId(int32_t channelId, int32_t channelType, char *sessionName, int32_t len);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2230,4 +2230,43 @@ int32_t ClientResetIdleTimeoutById(int32_t sessionId)
|
|||||||
(void)SoftBusMutexUnlock(&g_clientSessionServerList->lock);
|
(void)SoftBusMutexUnlock(&g_clientSessionServerList->lock);
|
||||||
TRANS_LOGE(TRANS_SDK, "not found session by sessionId=%{public}d", sessionId);
|
TRANS_LOGE(TRANS_SDK, "not found session by sessionId=%{public}d", sessionId);
|
||||||
return SOFTBUS_NOT_FIND;
|
return SOFTBUS_NOT_FIND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t ClientGetSessionNameByChannelId(int32_t channelId, int32_t channelType, char *sessionName, int32_t len)
|
||||||
|
{
|
||||||
|
if (channelId < 0 || sessionName == NULL || len <= 0 || len > SESSION_NAME_SIZE_MAX) {
|
||||||
|
TRANS_LOGW(TRANS_SDK, "Invalid param");
|
||||||
|
return SOFTBUS_INVALID_PARAM;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_clientSessionServerList == NULL) {
|
||||||
|
TRANS_LOGE(TRANS_INIT, "entry list not init");
|
||||||
|
return SOFTBUS_TRANS_SESSION_SERVER_NOINIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClientSessionServer *serverNode = NULL;
|
||||||
|
SessionInfo *sessionNode = NULL;
|
||||||
|
|
||||||
|
if (SoftBusMutexLock(&(g_clientSessionServerList->lock)) != 0) {
|
||||||
|
TRANS_LOGE(TRANS_SDK, "lock failed");
|
||||||
|
return SOFTBUS_LOCK_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
LIST_FOR_EACH_ENTRY(serverNode, &(g_clientSessionServerList->list), ClientSessionServer, node) {
|
||||||
|
if (IsListEmpty(&serverNode->sessionList)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
LIST_FOR_EACH_ENTRY(sessionNode, &(serverNode->sessionList), SessionInfo, node) {
|
||||||
|
if (sessionNode->channelId == channelId && sessionNode->channelType == (ChannelType)channelType) {
|
||||||
|
(void)memcpy_s(sessionName, len, serverNode->sessionName, len);
|
||||||
|
(void)SoftBusMutexUnlock(&(g_clientSessionServerList->lock));
|
||||||
|
return SOFTBUS_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
(void)SoftBusMutexUnlock(&(g_clientSessionServerList->lock));
|
||||||
|
TRANS_LOGE(TRANS_SDK, "not found session with channelId=%{public}d", channelId);
|
||||||
|
return SOFTBUS_ERR;
|
||||||
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "client_trans_tcp_direct_callback.h"
|
#include "client_trans_tcp_direct_callback.h"
|
||||||
#include "client_trans_tcp_direct_manager.h"
|
#include "client_trans_tcp_direct_manager.h"
|
||||||
|
#include "client_trans_session_manager.h"
|
||||||
#include "common_list.h"
|
#include "common_list.h"
|
||||||
#include "softbus_adapter_crypto.h"
|
#include "softbus_adapter_crypto.h"
|
||||||
#include "softbus_adapter_mem.h"
|
#include "softbus_adapter_mem.h"
|
||||||
@ -37,6 +38,7 @@
|
|||||||
#define MIN_BUF_LEN (1024 + DATA_EXTEND_LEN)
|
#define MIN_BUF_LEN (1024 + DATA_EXTEND_LEN)
|
||||||
|
|
||||||
#define BYTE_TOS 0x60
|
#define BYTE_TOS 0x60
|
||||||
|
#define COLLABORATE_BYTE_TOS 0x80
|
||||||
#define MESSAGE_TOS 0xC0
|
#define MESSAGE_TOS 0xC0
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -160,6 +162,14 @@ static char *TransTdcPackData(const TcpDirectChannelInfo *channel, const char *d
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool CheckCollaborationSessionName(const char *sessionName)
|
||||||
|
{
|
||||||
|
if (strstr(sessionName, "ohos.collaborationcenter") != NULL) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t TransTdcProcessPostData(const TcpDirectChannelInfo *channel, const char *data, uint32_t len,
|
static int32_t TransTdcProcessPostData(const TcpDirectChannelInfo *channel, const char *data, uint32_t len,
|
||||||
int32_t flags)
|
int32_t flags)
|
||||||
{
|
{
|
||||||
@ -174,7 +184,16 @@ static int32_t TransTdcProcessPostData(const TcpDirectChannelInfo *channel, cons
|
|||||||
SoftBusFree(buf);
|
SoftBusFree(buf);
|
||||||
return SOFTBUS_ENCRYPT_ERR;
|
return SOFTBUS_ENCRYPT_ERR;
|
||||||
}
|
}
|
||||||
|
char sessionName[SESSION_NAME_SIZE_MAX + 1] = { 0 };
|
||||||
|
if (ClientGetSessionNameByChannelId(channel->channelId, channel->detail.channelType,
|
||||||
|
sessionName, SESSION_NAME_SIZE_MAX)) {
|
||||||
|
TRANS_LOGE(TRANS_SDK, "failed to get sessionName, channelId=%{public}d", channel->channelId);
|
||||||
|
return SOFTBUS_ERR;
|
||||||
|
}
|
||||||
uint32_t tos = (flags == FLAG_BYTES) ? BYTE_TOS : MESSAGE_TOS;
|
uint32_t tos = (flags == FLAG_BYTES) ? BYTE_TOS : MESSAGE_TOS;
|
||||||
|
if (CheckCollaborationSessionName(sessionName)) {
|
||||||
|
tos = (flags == FLAG_BYTES) ? COLLABORATE_BYTE_TOS : MESSAGE_TOS;
|
||||||
|
}
|
||||||
if (SetIpTos(channel->detail.fd, tos) != SOFTBUS_OK) {
|
if (SetIpTos(channel->detail.fd, tos) != SOFTBUS_OK) {
|
||||||
SoftBusFree(buf);
|
SoftBusFree(buf);
|
||||||
return SOFTBUS_TCP_SOCKET_ERR;
|
return SOFTBUS_TCP_SOCKET_ERR;
|
||||||
|
Loading…
Reference in New Issue
Block a user