From 46475dea6243c8fd645d618913080f051c46de9c Mon Sep 17 00:00:00 2001 From: ding_dong_dong Date: Sat, 17 May 2025 11:04:09 +0800 Subject: [PATCH] modify multiuser watermask Signed-off-by: ding_dong_dong --- .../src/session_manager/route_head_handler_impl.cpp | 12 +++++++++++- .../src/session_manager/route_head_handler_impl.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.cpp b/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.cpp index bcce7f808..037bf5b42 100644 --- a/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.cpp +++ b/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.cpp @@ -84,6 +84,16 @@ void RouteHeadHandlerImpl::Init() session_.sourceUserId, Anonymous::Change(session_.targetDeviceId).c_str()); } +std::string RouteHeadHandlerImpl::GetTargetUserId() +{ + if (!session_.IsValid()) { + ZLOGE("session has no valid user to peer device, targetDeviceId:%{public}s", + Anonymous::Change(session_.targetDeviceId).c_str()); + return ""; + } + return std::to_string(session_.targetUserIds[0]); +} + DistributedDB::DBStatus RouteHeadHandlerImpl::GetHeadDataSize(uint32_t &headSize) { ZLOGD("begin"); @@ -328,7 +338,7 @@ bool RouteHeadHandlerImpl::ParseHeadDataUser(const uint8_t *data, uint32_t total for (const auto &item : session_.targetUserIds) { local.userId = item; if (SessionManager::GetInstance().CheckSession(local, peer, accountFlag)) { - UserInfo userInfo = { .receiveUser = std::to_string(item) }; + UserInfo userInfo = { .receiveUser = std::to_string(item), .sendUser = std::to_string(peer.userId) }; userInfos.emplace_back(userInfo); } } diff --git a/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.h b/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.h index bd3ff4261..793c94f35 100644 --- a/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.h +++ b/services/distributeddataservice/app/src/session_manager/route_head_handler_impl.h @@ -74,6 +74,7 @@ public: bool ParseHeadDataLen(const uint8_t *data, uint32_t totalLen, uint32_t &headSize) override; bool ParseHeadDataUser(const uint8_t *data, uint32_t totalLen, const std::string &label, std::vector &userInfos) override; + std::string GetTargetUserId() override; private: void Init(); -- Gitee