Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
9409da40
S
Startup Init Lite
项目概览
OpenHarmony
/
Startup Init Lite
1 年多 前同步成功
通知
3
Star
37
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Startup Init Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9409da40
编写于
5月 09, 2023
作者:
C
chengjinsong2
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改param_watcher空指针问题
Signed-off-by:
N
chengjinsong2
<
chengjinsong2@huawei.com
>
上级
1a391451
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
9 deletion
+9
-9
services/param/watcher/proxy/watcher_manager.cpp
services/param/watcher/proxy/watcher_manager.cpp
+8
-8
services/param/watcher/proxy/watcher_manager.h
services/param/watcher/proxy/watcher_manager.h
+1
-1
未找到文件。
services/param/watcher/proxy/watcher_manager.cpp
浏览文件 @
9409da40
...
...
@@ -99,7 +99,7 @@ int32_t WatcherManager::AddWatcher(const std::string &keyPrefix, uint32_t remote
SendMessage
(
group
,
MSG_ADD_WATCHER
);
}
}
SendLocalChange
(
keyPrefix
,
remoteWatcher
);
SendLocalChange
(
keyPrefix
,
remoteWatcher
Id
);
WATCHER_LOGI
(
"Add watcher %s remoteWatcherId: %u groupId %u success"
,
keyPrefix
.
c_str
(),
remoteWatcherId
,
group
->
GetGroupId
());
return
0
;
...
...
@@ -129,9 +129,7 @@ int32_t WatcherManager::RefreshWatcher(const std::string &keyPrefix, uint32_t re
WATCHER_LOGV
(
"Refresh watcher %s remoteWatcherId: %u"
,
keyPrefix
.
c_str
(),
remoteWatcherId
);
auto
group
=
GetWatcherGroup
(
keyPrefix
);
WATCHER_CHECK
(
group
!=
nullptr
,
return
0
,
"Can not find group %s"
,
keyPrefix
.
c_str
());
auto
remoteWatcher
=
GetRemoteWatcher
(
remoteWatcherId
);
WATCHER_CHECK
(
remoteWatcher
!=
nullptr
,
return
0
,
"Can not find watcher %s %d"
,
keyPrefix
.
c_str
(),
remoteWatcherId
);
SendLocalChange
(
keyPrefix
,
remoteWatcher
);
SendLocalChange
(
keyPrefix
,
remoteWatcherId
);
return
0
;
}
...
...
@@ -203,15 +201,16 @@ void WatcherManager::ProcessWatcherMessage(const ParamMessage *msg)
}
}
void
WatcherManager
::
SendLocalChange
(
const
std
::
string
&
keyPrefix
,
RemoteWatcherPtr
&
remoteWatcher
)
void
WatcherManager
::
SendLocalChange
(
const
std
::
string
&
keyPrefix
,
uint32_t
remoteWatcherId
)
{
struct
Context
{
char
*
buffer
;
RemoteWatcherPtr
remoteWatcher
;
uint32_t
remoteWatcherId
;
std
::
string
keyPrefix
;
WatcherManager
*
watcherManagerPtr
;
};
std
::
vector
<
char
>
buffer
(
PARAM_NAME_LEN_MAX
+
PARAM_CONST_VALUE_LEN_MAX
);
struct
Context
context
=
{
buffer
.
data
(),
remoteWatcher
,
keyPrefix
};
struct
Context
context
=
{
buffer
.
data
(),
remoteWatcher
Id
,
keyPrefix
,
this
};
// walk watcher
SystemTraversalParameter
(
""
,
[](
ParamHandle
handle
,
void
*
cookie
)
{
struct
Context
*
context
=
(
struct
Context
*
)(
cookie
);
...
...
@@ -222,7 +221,8 @@ void WatcherManager::SendLocalChange(const std::string &keyPrefix, RemoteWatcher
WATCHER_LOGV
(
"SendLocalChange name '%s' prefix '%s'"
,
context
->
buffer
,
context
->
keyPrefix
.
c_str
());
uint32_t
size
=
PARAM_CONST_VALUE_LEN_MAX
;
SystemGetParameterValue
(
handle
,
context
->
buffer
+
PARAM_NAME_LEN_MAX
,
&
size
);
context
->
remoteWatcher
->
ProcessParameterChange
(
auto
remoteWatcher
=
context
->
watcherManagerPtr
->
GetRemoteWatcher
(
context
->
remoteWatcherId
);
remoteWatcher
->
ProcessParameterChange
(
context
->
keyPrefix
,
context
->
buffer
,
context
->
buffer
+
PARAM_NAME_LEN_MAX
);
},
reinterpret_cast
<
void
*>
(
&
context
));
}
...
...
services/param/watcher/proxy/watcher_manager.h
浏览文件 @
9409da40
...
...
@@ -86,7 +86,7 @@ private:
void
RunLoop
();
void
StartLoop
();
void
StopLoop
();
void
SendLocalChange
(
const
std
::
string
&
keyPrefix
,
RemoteWatcherPtr
&
remoteWatcher
);
void
SendLocalChange
(
const
std
::
string
&
keyPrefix
,
uint32_t
remoteWatcherId
);
int
SendMessage
(
WatcherGroupPtr
group
,
int
type
);
int
GetServerFd
(
bool
retry
);
int
GetRemoteWatcherId
(
uint32_t
&
remoteWatcherId
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录