mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-11-23 08:49:59 +00:00
!8252 fix Self-control mechanism serverside
Merge pull request !8252 from wang_mingxu/master
This commit is contained in:
commit
32cb03db24
@ -55,7 +55,6 @@ void RemoveDelayDestroyMessage(uint64_t laneId);
|
||||
void DelLogicAndLaneRelationship(uint64_t laneId);
|
||||
int32_t UpdateReqListLaneId(uint64_t oldLaneId, uint64_t newLaneId);
|
||||
void NotifyFreeLaneResult(uint32_t laneReqId, int32_t errCode);
|
||||
void ProcessPowerControlInfoByLaneReqId(const LaneLinkType linkType, uint32_t laneReqId);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -285,6 +285,10 @@ static void HandleDetectWifiDirectApply(bool isDisableLowPower, WifiDirectLinkI
|
||||
|
||||
void DetectDisableWifiDirectApply(void)
|
||||
{
|
||||
if (!g_enabledLowPower) {
|
||||
LNN_LOGI(LNN_LANE, "low power not enabled");
|
||||
return;
|
||||
}
|
||||
WifiDirectLinkInfo wifiDirectInfo;
|
||||
(void)memset_s(&wifiDirectInfo, sizeof(wifiDirectInfo), 0, sizeof(wifiDirectInfo));
|
||||
if (LaneLock() != SOFTBUS_OK) {
|
||||
@ -1602,10 +1606,10 @@ int32_t DestroyLink(const char *networkId, uint32_t laneReqId, LaneLinkType type
|
||||
LNN_LOGE(LNN_LANE, "the networkId is nullptr");
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
if (type == LANE_HML && IsPowerControlEnabled()) {
|
||||
DetectDisableWifiDirectApply();
|
||||
}
|
||||
if (type == LANE_P2P || type == LANE_HML || type == LANE_HML_RAW) {
|
||||
if (IsPowerControlEnabled()) {
|
||||
DetectDisableWifiDirectApply();
|
||||
}
|
||||
LaneDeleteP2pAddress(networkId, false);
|
||||
int32_t errCode = LnnDisconnectP2p(networkId, laneReqId);
|
||||
if (errCode != SOFTBUS_OK) {
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "lnn_lane_link.h"
|
||||
#include "lnn_log.h"
|
||||
#include "lnn_node_info.h"
|
||||
#include "lnn_parameter_utils.h"
|
||||
#include "lnn_trans_lane.h"
|
||||
#include "bus_center_manager.h"
|
||||
#include "softbus_adapter_mem.h"
|
||||
@ -411,7 +412,9 @@ static void LnnOnWifiDirectDeviceOffline(const char *peerMac, const char *peerIp
|
||||
LNN_LOGE(LNN_STATE, "get lane state notify info fail");
|
||||
return;
|
||||
}
|
||||
DetectDisableWifiDirectApply();
|
||||
if (laneLinkInfo.type == LANE_HML && IsPowerControlEnabled()) {
|
||||
DetectDisableWifiDirectApply();
|
||||
}
|
||||
if (PostLaneStateChangeMessage(LANE_STATE_LINKDOWN, laneLinkInfo.peerUdid, &laneLinkInfo) != SOFTBUS_OK) {
|
||||
LNN_LOGE(LNN_LANE, "post laneState linkdown msg fail");
|
||||
}
|
||||
@ -534,7 +537,9 @@ static void LnnOnWifiDirectConnectedForSink(const struct WifiDirectSinkLink *lin
|
||||
if (AddLaneResourceToPool(&laneLinkInfo, laneId, true) != SOFTBUS_OK) {
|
||||
LNN_LOGE(LNN_LANE, "add server lane resource fail");
|
||||
}
|
||||
ProcessPowerControlInfoByLaneReqId(laneLinkInfo.type, INVALID_LANE_REQ_ID);
|
||||
if (laneLinkInfo.type == LANE_HML && IsPowerControlEnabled()) {
|
||||
DetectDisableWifiDirectApply();
|
||||
}
|
||||
}
|
||||
|
||||
static void LnnOnWifiDirectDisconnectedForSink(const struct WifiDirectSinkLink *link)
|
||||
|
@ -1329,7 +1329,7 @@ static void FreeLowPriorityLink(uint32_t laneReqId, LaneLinkType linkType)
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessPowerControlInfoByLaneReqId(const LaneLinkType linkType, uint32_t laneReqId)
|
||||
static void ProcessPowerControlInfoByLaneReqId(const LaneLinkType linkType, uint32_t laneReqId)
|
||||
{
|
||||
LaneTransType transType;
|
||||
if (Lock() != SOFTBUS_OK) {
|
||||
|
@ -1902,6 +1902,7 @@ ohos_unittest("LNNLaneListenerTest") {
|
||||
module_out_path = module_output_path
|
||||
sources = [
|
||||
"$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane.c",
|
||||
"$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_parameter_utils_virtual.c",
|
||||
"$dsoftbus_root_path/core/bus_center/service/src/bus_center_manager.c",
|
||||
"$dsoftbus_root_path/tests/core/bus_center/lnn/lane/src/lnn_lane_deps_mock.cpp",
|
||||
"$dsoftbus_root_path/tests/core/bus_center/lnn/lane_listener/lnn_lane_listener_deps_mock.cpp",
|
||||
|
@ -95,10 +95,5 @@ void DetectDisableWifiDirectApply(void)
|
||||
{
|
||||
GetLaneListenerDepsInterface()->DetectDisableWifiDirectApply();
|
||||
}
|
||||
|
||||
void ProcessPowerControlInfoByLaneReqId(const LaneLinkType linkType, uint32_t laneReqId)
|
||||
{
|
||||
GetLaneListenerDepsInterface()->ProcessPowerControlInfoByLaneReqId(linkType, laneReqId);
|
||||
}
|
||||
}
|
||||
} // namespace OHOS
|
||||
|
@ -42,7 +42,6 @@ public:
|
||||
virtual int32_t AddLaneResourceToPool(const LaneLinkInfo *linkInfo, uint64_t laneId, bool isServerSide) = 0;
|
||||
virtual int32_t DelLaneResourceByLaneId(uint64_t laneId, bool isServerSide) = 0;
|
||||
virtual void DetectDisableWifiDirectApply(void) = 0;
|
||||
virtual void ProcessPowerControlInfoByLaneReqId(const LaneLinkType linkType, uint32_t laneReqId) = 0;
|
||||
};
|
||||
|
||||
class LaneListenerDepsInterfaceMock : public LaneListenerDepsInterface {
|
||||
@ -64,7 +63,6 @@ public:
|
||||
MOCK_METHOD3(AddLaneResourceToPool, int32_t (const LaneLinkInfo *linkInfo, uint64_t laneId, bool isServerSide));
|
||||
MOCK_METHOD2(DelLaneResourceByLaneId, int32_t (uint64_t laneId, bool isServerSide));
|
||||
MOCK_METHOD0(DetectDisableWifiDirectApply, void (void));
|
||||
MOCK_METHOD2(ProcessPowerControlInfoByLaneReqId, void (const LaneLinkType linkType, uint32_t laneReqId));
|
||||
};
|
||||
} // namespace OHOS
|
||||
#endif // LNN_LANE_LISTENER_DEPS_MOCK_H
|
||||
|
Loading…
Reference in New Issue
Block a user