1 Star 0 Fork 0

廖永煌/lyh

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
br_753_2.diff 7.03 KB
一键复制 编辑 原始数据 按行查看 历史
廖永煌 提交于 2025-05-23 11:03 +08:00 . 1
diff --git a/frameworks/libs/distributeddb/communicator/include/frame_retainer.h b/frameworks/libs/distributeddb/communicator/include/frame_retainer.h
index 854bc0923..79837f450 100644
--- a/frameworks/libs/distributeddb/communicator/include/frame_retainer.h
+++ b/frameworks/libs/distributeddb/communicator/include/frame_retainer.h
@@ -29,14 +29,14 @@ class SerialBuffer; // Forward Declarations
struct FrameInfo {
SerialBuffer *buffer = nullptr;
std::string srcTarget;
- std::string senderUser;
+ std::string sendUser;
LabelType commLabel;
uint32_t frameId = 0u;
};
struct RetainWork {
SerialBuffer *buffer = nullptr;
- std::string senderUser;
+ std::string sendUser;
uint32_t frameId = 0u;
uint32_t remainTime = 0u; // in second
};
diff --git a/frameworks/libs/distributeddb/communicator/src/communicator.cpp b/frameworks/libs/distributeddb/communicator/src/communicator.cpp
index 2171b170a..ef60f1962 100644
--- a/frameworks/libs/distributeddb/communicator/src/communicator.cpp
+++ b/frameworks/libs/distributeddb/communicator/src/communicator.cpp
@@ -147,14 +147,14 @@ int Communicator::SendMessage(const std::string &dstTarget, const Message *inMsg
}
void Communicator::OnBufferReceive(const std::string &srcTarget, const SerialBuffer *inBuf,
- const std::string &senderUser)
+ const std::string &sendUser)
{
std::lock_guard<std::mutex> messageHandleLockGuard(messageHandleMutex_);
if (!srcTarget.empty() && inBuf != nullptr && onMessageHandle_) {
int error = E_OK;
// if error is not E_OK, null pointer will be returned
Message *message = ProtocolProto::ToMessage(inBuf, error);
- message->SetSenderUserId(senderUser);
+ message->SetSenderUserId(sendUser);
delete inBuf;
inBuf = nullptr;
// message is not nullptr if error is E_OK or error is E_NOT_REGISTER.
diff --git a/frameworks/libs/distributeddb/communicator/src/communicator.h b/frameworks/libs/distributeddb/communicator/src/communicator.h
index d58ac48a5..2a6aaf82d 100644
--- a/frameworks/libs/distributeddb/communicator/src/communicator.h
+++ b/frameworks/libs/distributeddb/communicator/src/communicator.h
@@ -56,7 +56,7 @@ public:
const OnSendEnd &onEnd) override;
// Call by CommunicatorAggregator directly
- void OnBufferReceive(const std::string &srcTarget, const SerialBuffer *inBuf, const std::string &senderUser);
+ void OnBufferReceive(const std::string &srcTarget, const SerialBuffer *inBuf, const std::string &sendUser);
// Call by CommunicatorAggregator directly
void OnConnectChange(const std::string &target, bool isConnect);
diff --git a/frameworks/libs/distributeddb/communicator/src/communicator_aggregator.cpp b/frameworks/libs/distributeddb/communicator/src/communicator_aggregator.cpp
index 24d174711..6b1fa847c 100644
--- a/frameworks/libs/distributeddb/communicator/src/communicator_aggregator.cpp
+++ b/frameworks/libs/distributeddb/communicator/src/communicator_aggregator.cpp
@@ -276,7 +276,7 @@ void CommunicatorAggregator::ActivateCommunicator(const LabelType &commLabel, co
// Do Redeliver, the communicator is responsible to deal with the frame
std::list<FrameInfo> framesToRedeliver = retainer_.FetchFramesForSpecificCommunicator(commLabel);
for (auto &entry : framesToRedeliver) {
- commMap_[userId].at(commLabel).first->OnBufferReceive(entry.srcTarget, entry.buffer, entry.senderUser);
+ commMap_[userId].at(commLabel).first->OnBufferReceive(entry.srcTarget, entry.buffer, entry.sendUser);
}
}
@@ -683,7 +683,8 @@ int CommunicatorAggregator::OnAppLayerFrameReceive(const ReceiveBytesInfo &recei
if (receiveBytesInfo.headLength != 0) {
int ret = GetDataUserId(inResult, toLabel, userInfoProc, receiveBytesInfo.srcTarget, userInfo);
if (ret != E_OK || userInfo.receiveUser.empty() || userInfo.sendUser.empty()) {
- LOGE("[CommAggr][AppReceive] get data user id err, ret=%d", ret);
+ LOGE("[CommAggr][AppReceive] get data user id err, ret=%d, empty receiveUser=%d, empty sendUser=%d", ret,
+ userInfo.receiveUser.empty(), userInfo.sendUser.empty());
delete inFrameBuffer;
inFrameBuffer = nullptr;
return ret != E_OK ? ret : -E_NO_TRUSTED_USER;
@@ -758,10 +759,10 @@ int CommunicatorAggregator::TryDeliverAppLayerFrameToCommunicatorNoMutex(const s
SerialBuffer *&inFrameBuffer, const LabelType &toLabel, const UserInfo &userInfo)
{
// Ignore nonactivated communicator, which is regarded as inexistent
- const std::string &senderUser = userInfo.sendUser;
+ const std::string &sendUser = userInfo.sendUser;
const std::string &receiveUser = userInfo.receiveUser;
if (commMap_[receiveUser].count(toLabel) != 0 && commMap_[receiveUser].at(toLabel).second) {
- commMap_[receiveUser].at(toLabel).first->OnBufferReceive(srcTarget, inFrameBuffer, senderUser);
+ commMap_[receiveUser].at(toLabel).first->OnBufferReceive(srcTarget, inFrameBuffer, sendUser);
// Frame handed over to communicator who is responsible to delete it. The frame is deleted here after return.
inFrameBuffer = nullptr;
return E_OK;
@@ -783,7 +784,7 @@ int CommunicatorAggregator::TryDeliverAppLayerFrameToCommunicatorNoMutex(const s
}
}
if (communicator != nullptr && (receiveUser.empty() || isEmpty)) {
- communicator->OnBufferReceive(srcTarget, inFrameBuffer, senderUser);
+ communicator->OnBufferReceive(srcTarget, inFrameBuffer, sendUser);
inFrameBuffer = nullptr;
return E_OK;
}
diff --git a/frameworks/libs/distributeddb/communicator/src/frame_retainer.cpp b/frameworks/libs/distributeddb/communicator/src/frame_retainer.cpp
index c51fec9ed..b1b42011e 100644
--- a/frameworks/libs/distributeddb/communicator/src/frame_retainer.cpp
+++ b/frameworks/libs/distributeddb/communicator/src/frame_retainer.cpp
@@ -85,7 +85,7 @@ void FrameRetainer::RetainFrame(const FrameInfo &inFrame)
if (inFrame.buffer == nullptr) {
return; // Never gonna happen
}
- RetainWork work{inFrame.buffer, inFrame.senderUser, inFrame.frameId, MAX_RETAIN_TIME};
+ RetainWork work{inFrame.buffer, inFrame.sendUser, inFrame.frameId, MAX_RETAIN_TIME};
if (work.buffer->GetSize() > MAX_RETAIN_FRAME_SIZE) {
LOGE("[Retainer][Retain] Frame size=%u over limit=%u.", work.buffer->GetSize(), MAX_RETAIN_FRAME_SIZE);
delete work.buffer;
@@ -140,7 +140,7 @@ std::list<FrameInfo> FrameRetainer::FetchFramesForSpecificCommunicator(const Lab
for (auto &entry : fetchOrder) {
RetainWork &work = perLabel[entry.second][entry.first];
LogRetainInfo("[Retainer][Fetch] FETCH-OUT", inCommLabel, entry.second, entry.first, work);
- outFrameList.emplace_back(FrameInfo{work.buffer, entry.second, work.senderUser, inCommLabel, work.frameId});
+ outFrameList.emplace_back(FrameInfo{work.buffer, entry.second, work.sendUser, inCommLabel, work.frameId});
// Update statistics
totalSizeByByte_ -= work.buffer->GetSize();
totalRetainFrames_--;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liao-yonghuang/lyh.git
git@gitee.com:liao-yonghuang/lyh.git
liao-yonghuang
lyh
lyh
master

搜索帮助