Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
4346feb7
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4346feb7
编写于
7月 26, 2022
作者:
L
laiguizhong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改conntect为connect
Signed-off-by:
N
laiguizhong
<
laiguizhong@huawei.com
>
上级
7815064b
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
27 addition
and
27 deletion
+27
-27
interfaces/innerkits/control_fd/control_fd_service.c
interfaces/innerkits/control_fd/control_fd_service.c
+2
-2
services/loopevent/include/loop_event.h
services/loopevent/include/loop_event.h
+7
-7
services/loopevent/task/le_streamtask.c
services/loopevent/task/le_streamtask.c
+5
-5
services/loopevent/task/le_task.h
services/loopevent/task/le_task.h
+4
-4
services/param/linux/param_message.c
services/param/linux/param_message.c
+2
-2
services/param/linux/param_message.h
services/param/linux/param_message.h
+2
-2
services/param/linux/param_msgadp.c
services/param/linux/param_msgadp.c
+1
-1
services/param/linux/param_request.c
services/param/linux/param_request.c
+1
-1
services/param/watcher/proxy/watcher_manager.cpp
services/param/watcher/proxy/watcher_manager.cpp
+1
-1
test/unittest/init/loopevent_unittest.cpp
test/unittest/init/loopevent_unittest.cpp
+2
-2
未找到文件。
interfaces/innerkits/control_fd/control_fd_service.c
浏览文件 @
4346feb7
...
...
@@ -93,7 +93,7 @@ static int SendMessage(LoopHandle loop, TaskHandle task, const char *message)
return
0
;
}
static
int
CmdOnIncommingConn
t
ect
(
const
LoopHandle
loop
,
const
TaskHandle
server
)
static
int
CmdOnIncommingConnect
(
const
LoopHandle
loop
,
const
TaskHandle
server
)
{
TaskHandle
client
=
NULL
;
LE_StreamInfo
info
=
{};
...
...
@@ -128,7 +128,7 @@ void CmdServiceInit(const char *socketPath, CallbackControlFdProcess func)
info
.
socketId
=
-
1
;
info
.
baseInfo
.
close
=
NULL
;
info
.
disConnectComplete
=
NULL
;
info
.
incommingConn
tect
=
CmdOnIncommingConnt
ect
;
info
.
incommingConn
ect
=
CmdOnIncommingConn
ect
;
info
.
sendMessageComplete
=
NULL
;
info
.
recvMessage
=
NULL
;
g_controlFdFunc
=
func
;
...
...
services/loopevent/include/loop_event.h
浏览文件 @
4346feb7
...
...
@@ -93,17 +93,17 @@ typedef struct {
#define TASK_SERVER (0x01 << 16)
#define TASK_CONNECT (0x02 << 16)
#define TASK_TEST (0x01 << 24)
typedef
void
(
*
LE_DisConn
t
ectComplete
)(
const
TaskHandle
client
);
typedef
void
(
*
LE_Conn
t
ectComplete
)(
const
TaskHandle
client
);
typedef
void
(
*
LE_DisConnectComplete
)(
const
TaskHandle
client
);
typedef
void
(
*
LE_ConnectComplete
)(
const
TaskHandle
client
);
typedef
void
(
*
LE_SendMessageComplete
)(
const
TaskHandle
taskHandle
,
BufferHandle
handle
);
typedef
void
(
*
LE_RecvMessage
)(
const
TaskHandle
taskHandle
,
const
uint8_t
*
buffer
,
uint32_t
buffLen
);
typedef
int
(
*
LE_IncommingConn
t
ect
)(
const
LoopHandle
loopHandle
,
const
TaskHandle
serverTask
);
typedef
int
(
*
LE_IncommingConnect
)(
const
LoopHandle
loopHandle
,
const
TaskHandle
serverTask
);
typedef
struct
{
LE_BaseInfo
baseInfo
;
char
*
server
;
int
socketId
;
LE_DisConn
t
ectComplete
disConnectComplete
;
LE_IncommingConn
tect
incommingConnt
ect
;
LE_DisConnectComplete
disConnectComplete
;
LE_IncommingConn
ect
incommingConn
ect
;
LE_SendMessageComplete
sendMessageComplete
;
LE_RecvMessage
recvMessage
;
}
LE_StreamServerInfo
;
...
...
@@ -111,8 +111,8 @@ typedef struct {
typedef
struct
{
LE_BaseInfo
baseInfo
;
char
*
server
;
LE_DisConn
t
ectComplete
disConnectComplete
;
LE_Conn
t
ectComplete
connectComplete
;
LE_DisConnectComplete
disConnectComplete
;
LE_ConnectComplete
connectComplete
;
LE_SendMessageComplete
sendMessageComplete
;
LE_RecvMessage
recvMessage
;
}
LE_StreamInfo
;
...
...
services/loopevent/task/le_streamtask.c
浏览文件 @
4346feb7
...
...
@@ -141,9 +141,9 @@ static LE_STATUS HandleServerEvent_(const LoopHandle loopHandle, const TaskHandl
return
LE_FAILURE
;
}
StreamServerTask
*
server
=
(
StreamServerTask
*
)
serverTask
;
LE_ONLY_CHECK
(
server
->
incommingConn
t
ect
!=
NULL
,
return
LE_SUCCESS
);
LE_ONLY_CHECK
(
server
->
incommingConnect
!=
NULL
,
return
LE_SUCCESS
);
int
ret
=
server
->
incommingConn
t
ect
(
loopHandle
,
serverTask
);
int
ret
=
server
->
incommingConnect
(
loopHandle
,
serverTask
);
if
(
ret
!=
LE_SUCCESS
)
{
LE_LOGE
(
"HandleServerEvent_ fd %d do not accept socket"
,
GetSocketFd
(
serverTask
));
}
...
...
@@ -157,8 +157,8 @@ LE_STATUS LE_CreateStreamServer(const LoopHandle loopHandle,
{
LE_CHECK
(
loopHandle
!=
NULL
&&
taskHandle
!=
NULL
&&
info
!=
NULL
,
return
LE_INVALID_PARAM
,
"Invalid parameters"
);
LE_CHECK
(
info
->
server
!=
NULL
,
return
LE_INVALID_PARAM
,
"Invalid parameters server"
);
LE_CHECK
(
info
->
incommingConn
t
ect
!=
NULL
,
return
LE_INVALID_PARAM
,
"Invalid parameters incommingConn
t
ect %s"
,
info
->
server
);
LE_CHECK
(
info
->
incommingConnect
!=
NULL
,
return
LE_INVALID_PARAM
,
"Invalid parameters incommingConnect %s"
,
info
->
server
);
int
fd
=
info
->
socketId
;
if
(
info
->
socketId
<=
0
)
{
...
...
@@ -173,7 +173,7 @@ LE_STATUS LE_CreateStreamServer(const LoopHandle loopHandle,
return
LE_NO_MEMORY
,
"Failed to create task"
);
task
->
base
.
handleEvent
=
HandleServerEvent_
;
task
->
base
.
innerClose
=
HandleStreamTaskClose_
;
task
->
incommingConn
tect
=
info
->
incommingConnt
ect
;
task
->
incommingConn
ect
=
info
->
incommingConn
ect
;
loop
->
addEvent
(
loop
,
(
const
BaseTask
*
)
task
,
Event_Read
);
int
ret
=
memcpy_s
(
task
->
server
,
strlen
(
info
->
server
)
+
1
,
info
->
server
,
strlen
(
info
->
server
)
+
1
);
LE_CHECK
(
ret
==
0
,
return
LE_FAILURE
,
"Failed to copy server name %s"
,
info
->
server
);
...
...
services/loopevent/task/le_task.h
浏览文件 @
4346feb7
...
...
@@ -72,7 +72,7 @@ typedef struct LiteTask_ {
typedef
struct
{
BaseTask
base
;
LE_IncommingConn
tect
incommingConnt
ect
;
LE_IncommingConn
ect
incommingConn
ect
;
char
server
[
0
];
}
StreamServerTask
;
...
...
@@ -91,13 +91,13 @@ typedef struct {
StreamServerTask
*
serverTask
;
LE_SendMessageComplete
sendMessageComplete
;
LE_RecvMessage
recvMessage
;
LE_DisConn
t
ectComplete
disConnectComplete
;
LE_DisConnectComplete
disConnectComplete
;
}
StreamConnectTask
;
typedef
struct
{
StreamTask
stream
;
LE_DisConn
t
ectComplete
disConnectComplete
;
LE_Conn
t
ectComplete
connectComplete
;
LE_DisConnectComplete
disConnectComplete
;
LE_ConnectComplete
connectComplete
;
LE_SendMessageComplete
sendMessageComplete
;
LE_RecvMessage
recvMessage
;
uint32_t
connected
:
1
;
...
...
services/param/linux/param_message.c
浏览文件 @
4346feb7
...
...
@@ -20,7 +20,7 @@
#include "param_utils.h"
#include "securec.h"
int
Conn
t
ectServer
(
int
fd
,
const
char
*
servername
)
int
ConnectServer
(
int
fd
,
const
char
*
servername
)
{
PARAM_CHECK
(
fd
>=
0
,
return
-
1
,
"Invalid fd %d"
,
fd
);
int
opt
=
1
;
...
...
@@ -36,7 +36,7 @@ int ConntectServer(int fd, const char *servername)
int
len
=
offsetof
(
struct
sockaddr_un
,
sun_path
)
+
strlen
(
addr
.
sun_path
);
ret
=
connect
(
fd
,
(
struct
sockaddr
*
)
&
addr
,
len
);
PARAM_CHECK
(
ret
!=
-
1
,
return
-
1
,
"Failed to connect server %s %d"
,
servername
,
errno
);
PARAM_LOGV
(
"Conn
t
ectServer %s success"
,
servername
);
PARAM_LOGV
(
"ConnectServer %s success"
,
servername
);
return
0
;
}
...
...
services/param/linux/param_message.h
浏览文件 @
4346feb7
...
...
@@ -75,7 +75,7 @@ typedef int (*RecvMessage)(const ParamTaskPtr stream, const ParamMessage *msg);
typedef
struct
{
uint32_t
flags
;
char
*
server
;
LE_IncommingConn
t
ect
incomingConnect
;
LE_IncommingConnect
incomingConnect
;
RecvMessage
recvMessage
;
LE_Close
close
;
}
ParamStreamInfo
;
...
...
@@ -97,7 +97,7 @@ int FillParamMsgContent(const ParamMessage *request, uint32_t *start, int type,
ParamMsgContent
*
GetNextContent
(
const
ParamMessage
*
reqest
,
uint32_t
*
offset
);
ParamMessage
*
CreateParamMessage
(
int
type
,
const
char
*
name
,
uint32_t
msgSize
);
int
Conn
t
ectServer
(
int
fd
,
const
char
*
servername
);
int
ConnectServer
(
int
fd
,
const
char
*
servername
);
#ifdef STARTUP_INIT_TEST
int
ProcessMessage
(
const
ParamTaskPtr
worker
,
const
ParamMessage
*
msg
);
...
...
services/param/linux/param_msgadp.c
浏览文件 @
4346feb7
...
...
@@ -52,7 +52,7 @@ int ParamServerCreate(ParamTaskPtr *stream, const ParamStreamInfo *streamInfo)
info
.
baseInfo
.
flags
=
TASK_STREAM
|
TASK_PIPE
|
TASK_SERVER
;
info
.
server
=
streamInfo
->
server
;
info
.
baseInfo
.
close
=
streamInfo
->
close
;
info
.
incommingConn
t
ect
=
streamInfo
->
incomingConnect
;
info
.
incommingConnect
=
streamInfo
->
incomingConnect
;
return
LE_CreateStreamServer
(
LE_GetDefaultLoop
(),
stream
,
&
info
);
}
...
...
services/param/linux/param_request.c
浏览文件 @
4346feb7
...
...
@@ -112,7 +112,7 @@ static int GetClientSocket(int timeout)
time
.
tv_usec
=
0
;
int
clientFd
=
socket
(
AF_UNIX
,
SOCK_STREAM
,
0
);
PARAM_CHECK
(
clientFd
>=
0
,
return
-
1
,
"Failed to create socket"
);
int
ret
=
Conn
t
ectServer
(
clientFd
,
CLIENT_PIPE_NAME
);
int
ret
=
ConnectServer
(
clientFd
,
CLIENT_PIPE_NAME
);
if
(
ret
==
0
)
{
setsockopt
(
clientFd
,
SOL_SOCKET
,
SO_SNDTIMEO
,
(
char
*
)
&
time
,
sizeof
(
struct
timeval
));
setsockopt
(
clientFd
,
SOL_SOCKET
,
SO_RCVTIMEO
,
(
char
*
)
&
time
,
sizeof
(
struct
timeval
));
...
...
services/param/watcher/proxy/watcher_manager.cpp
浏览文件 @
4346feb7
...
...
@@ -296,7 +296,7 @@ int WatcherManager::GetServerFd(bool retry)
serverFd_
=
socket
(
PF_UNIX
,
SOCK_STREAM
,
0
);
int
flags
=
fcntl
(
serverFd_
,
F_GETFL
,
0
);
(
void
)
fcntl
(
serverFd_
,
F_SETFL
,
flags
&
~
O_NONBLOCK
);
ret
=
Conn
t
ectServer
(
serverFd_
,
CLIENT_PIPE_NAME
);
ret
=
ConnectServer
(
serverFd_
,
CLIENT_PIPE_NAME
);
if
(
ret
==
0
)
{
break
;
}
...
...
test/unittest/init/loopevent_unittest.cpp
浏览文件 @
4346feb7
...
...
@@ -163,7 +163,7 @@ public:
info
.
baseInfo
.
flags
=
TASK_STREAM
|
TASK_PIPE
|
TASK_SERVER
|
TASK_TEST
;
info
.
server
=
(
char
*
)
"/data/testpipe"
;
info
.
baseInfo
.
close
=
OnClose
;
info
.
incommingConn
t
ect
=
IncomingConnect
;
info
.
incommingConnect
=
IncomingConnect
;
LE_CreateStreamServer
(
LE_GetDefaultLoop
(),
&
serverTask_
,
&
info
);
if
(
serverTask_
==
nullptr
)
{
return
;
...
...
@@ -246,7 +246,7 @@ public:
info
.
baseInfo
.
flags
=
TASK_PIPE
|
TASK_CONNECT
|
TASK_TEST
;
info
.
server
=
(
char
*
)
"/data/testpipe"
;
info
.
baseInfo
.
close
=
OnClose
;
info
.
incommingConn
t
ect
=
IncomingConnect
;
info
.
incommingConnect
=
IncomingConnect
;
info
.
socketId
=
1111
;
// 1111 is test fd
LE_CreateStreamServer
(
LE_GetDefaultLoop
(),
&
serverTask
,
&
info
);
EXPECT_NE
(
serverTask
,
nullptr
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录