mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-12-18 15:28:15 +00:00
fix:add lnn coap reconnect func
Signed-off-by: fangdong7 <fangdong7@huawei.com>
This commit is contained in:
parent
fcd59913db
commit
e39eaaf714
@ -205,3 +205,19 @@ if (lk_enhanced) {
|
||||
bus_center_server_inc +=
|
||||
[ "$dsoftbus_root_path/core/adapter/bus_center/include" ]
|
||||
}
|
||||
|
||||
lnn_coap_dep_dir = "dsoftbus_enhance/core/bus_center/lnn/disc_mgr"
|
||||
lnn_disc_enhanced = exec_script("$dsoftbus_root_path/check_sub_module.py",
|
||||
[
|
||||
"$native_source_path",
|
||||
"$lnn_coap_dep_dir",
|
||||
],
|
||||
"value")
|
||||
|
||||
if (dsoftbus_feature_lnn_net && lnn_disc_enhanced) {
|
||||
disc_mgr_enhance_path =
|
||||
"$dsoftbus_root_path/dsoftbus_enhance/core/bus_center/lnn/disc_mgr"
|
||||
bus_center_server_src += [ "$disc_mgr_enhance_path/src/lnn_coap_adapter.c" ]
|
||||
} else {
|
||||
bus_center_server_src += [ "$dsoftbus_root_path/core/bus_center/lnn/disc_mgr/src/lnn_coap_adapter_virtual.c" ]
|
||||
}
|
||||
|
@ -40,6 +40,14 @@ int32_t LnnStartCoapDiscovery(void);
|
||||
|
||||
int32_t LnnStopCoapDiscovery(void);
|
||||
|
||||
void LnnDestroyCoapConnectList(void);
|
||||
|
||||
void LnnCoapConnect(const char *ip);
|
||||
|
||||
void LnnCoapConnectInit(void);
|
||||
|
||||
void LnnCoapConnectDeinit(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
|
33
core/bus_center/lnn/disc_mgr/src/lnn_coap_adapter_virtual.c
Normal file
33
core/bus_center/lnn/disc_mgr/src/lnn_coap_adapter_virtual.c
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "lnn_coap_discovery_impl.h"
|
||||
|
||||
void LnnDestroyCoapConnectList(void)
|
||||
{
|
||||
}
|
||||
|
||||
void LnnCoapConnect(const char *ip)
|
||||
{
|
||||
(void)ip;
|
||||
}
|
||||
|
||||
void LnnCoapConnectInit(void)
|
||||
{
|
||||
}
|
||||
|
||||
void LnnCoapConnectDeinit(void)
|
||||
{
|
||||
}
|
@ -63,6 +63,7 @@ static void DeviceFound(const DeviceInfo *device, const InnerDeviceInfoAddtions
|
||||
}
|
||||
if (device->addr[0].info.ip.port == 0) {
|
||||
DISC_LOGE(DISC_LNN, "discovery get port is 0!");
|
||||
LnnCoapConnect(device->addr[0].info.ip.ip);
|
||||
return;
|
||||
}
|
||||
addr.type = device->addr[0].type;
|
||||
@ -123,6 +124,7 @@ int32_t LnnStartCoapDiscovery(void)
|
||||
InnerCallback callback = {
|
||||
.innerCb = g_discCb,
|
||||
};
|
||||
LnnDestroyCoapConnectList();
|
||||
return LnnStartDiscDevice(NULL, &subscribeInfo, &callback, true);
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "bus_center_event.h"
|
||||
#include "bus_center_decision_center.h"
|
||||
#include "lnn_async_callback_utils.h"
|
||||
#include "lnn_coap_discovery_impl.h"
|
||||
#include "lnn_decision_center.h"
|
||||
#include "lnn_discovery_manager.h"
|
||||
#include "lnn_event_monitor.h"
|
||||
@ -141,6 +142,7 @@ static void BusCenterServerDelayInit(void *para)
|
||||
g_lnnLocalConfigInit.initDelayImpl[i].isInit = true;
|
||||
}
|
||||
}
|
||||
LnnCoapConnectInit();
|
||||
if (ret != SOFTBUS_OK) {
|
||||
retry++;
|
||||
SoftBusLooper *looper = GetLooper(LOOP_TYPE_DEFAULT);
|
||||
@ -237,5 +239,6 @@ void BusCenterServerDeinit(void)
|
||||
LnnDeinitNetLedger();
|
||||
DeinitDecisionCenter();
|
||||
LnnDeinitMetaNode();
|
||||
LnnCoapConnectDeinit();
|
||||
LNN_LOGI(LNN_INIT, "bus center server deinit");
|
||||
}
|
||||
|
@ -1545,6 +1545,7 @@ ohos_unittest("LNNDiscoveryInterfaceTest") {
|
||||
"$dsoftbus_root_path/core/authentication/src/auth_deviceprofile_virtual.cpp",
|
||||
"$dsoftbus_root_path/core/authentication/src/auth_hichain_adapter.c",
|
||||
"$dsoftbus_root_path/core/authentication/src/auth_interface.c",
|
||||
"$dsoftbus_root_path/core/bus_center/lnn/disc_mgr/src/lnn_coap_adapter_virtual.c",
|
||||
"$dsoftbus_root_path/core/bus_center/lnn/disc_mgr/src/lnn_discovery_interface.c",
|
||||
"$dsoftbus_root_path/core/bus_center/utils/src/lnn_file_utils.c",
|
||||
"$dsoftbus_root_path/tests/core/authentication/unittest/auth_common_mock.cpp",
|
||||
|
Loading…
Reference in New Issue
Block a user