Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
communication_ipc
提交
ef50e2ad
C
communication_ipc
项目概览
OpenHarmony
/
communication_ipc
12 个月 前同步成功
通知
20
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
communication_ipc
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ef50e2ad
编写于
1月 18, 2022
作者:
Y
yangguangzhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
naming convention rectification
Signed-off-by:
N
yangguangzhao
<
yangguangzhao1@huawei.com
>
上级
97da4435
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
31 addition
and
28 deletion
+31
-28
ipc/native/c/manager/include/ipc_thread_pool.h
ipc/native/c/manager/include/ipc_thread_pool.h
+1
-1
ipc/native/c/manager/src/serializer.c
ipc/native/c/manager/src/serializer.c
+1
-1
ipc/native/c/rpc/include/rpc_process_skeleton.h
ipc/native/c/rpc/include/rpc_process_skeleton.h
+2
-2
ipc/native/c/rpc/ipc_adapter/mini/ipc_proxy_inner.c
ipc/native/c/rpc/ipc_adapter/mini/ipc_proxy_inner.c
+2
-1
ipc/native/c/rpc/src/dbinder_invoker.c
ipc/native/c/rpc/src/dbinder_invoker.c
+21
-20
ipc/native/c/rpc/src/rpc_process_skeleton.c
ipc/native/c/rpc/src/rpc_process_skeleton.c
+2
-2
ipc/native/c/rpc/trans_adapter/include/rpc_trans.h
ipc/native/c/rpc/trans_adapter/include/rpc_trans.h
+1
-1
ipc/test/rpc/samgr/rpc_samgr.c
ipc/test/rpc/samgr/rpc_samgr.c
+1
-0
未找到文件。
ipc/native/c/manager/include/ipc_thread_pool.h
浏览文件 @
ef50e2ad
...
...
@@ -47,7 +47,7 @@ typedef struct {
char
callerDeviceID
[
DEVICEID_LENGTH
+
1
];
bool
stopWorkThread
;
uint64_t
seqNumber
;
uint32_t
clientF
d
;
uint32_t
sessionI
d
;
}
ThreadContext
;
typedef
struct
{
...
...
ipc/native/c/manager/src/serializer.c
浏览文件 @
ef50e2ad
...
...
@@ -202,9 +202,9 @@ bool ReadRemoteObject(IpcIo *io, SvcIdentity *svc)
svc
->
handle
=
MIN_BINDER_HANDLE
;
svc
->
cookie
=
obj
->
cookie
;
}
else
{
WaitForProxyInit
(
obj
);
svc
->
handle
=
obj
->
handle
;
svc
->
cookie
=
obj
->
cookie
;
WaitForProxyInit
(
svc
);
}
return
true
;
}
...
...
ipc/native/c/rpc/include/rpc_process_skeleton.h
浏览文件 @
ef50e2ad
...
...
@@ -50,7 +50,7 @@ typedef struct {
typedef
struct
{
UTILS_DL_LIST
list
;
pthread_t
threadId
;
uint32_t
listenF
d
;
uint32_t
sessionI
d
;
uint32_t
packageSize
;
char
*
buffer
;
}
ThreadProcessInfo
;
...
...
@@ -104,7 +104,7 @@ typedef struct {
size_t
bufferSize
;
size_t
offsetsSize
;
uintptr_t
offsets
;
uint32_t
s
ocket
Id
;
uint32_t
s
ession
Id
;
void
*
buffer
;
}
ThreadMessageInfo
;
...
...
ipc/native/c/rpc/ipc_adapter/mini/ipc_proxy_inner.c
浏览文件 @
ef50e2ad
...
...
@@ -217,7 +217,8 @@ static int GetSessionFromDBinderService(SvcIdentity *svc)
return
proto
;
}
UpdateClientSession
(
svc
->
handle
,
sessionObject
,
localBusName
,
session
->
serviceName
,
session
->
deviceIdInfo
.
toDeviceId
);
UpdateClientSession
(
svc
->
handle
,
sessionObject
,
localBusName
,
session
->
serviceName
,
session
->
deviceIdInfo
.
toDeviceId
);
return
proto
;
}
...
...
ipc/native/c/rpc/src/dbinder_invoker.c
浏览文件 @
ef50e2ad
...
...
@@ -26,6 +26,7 @@
#include "rpc_errno.h"
#include "rpc_trans.h"
#include "rpc_trans_callback.h"
#include "rpc_process_skeleton.h"
#include "ipc_skeleton.h"
#include "ipc_process_skeleton.h"
#include "ipc_thread_pool.h"
...
...
@@ -46,14 +47,14 @@ void DeleteRpcInvoker(RemoteInvoker *remoteInvoker)
free
(
remoteInvoker
);
}
static
HandleSessionList
*
GetSessionObject
(
uint32_t
handle
,
uint32_t
s
ocket
Id
)
static
HandleSessionList
*
GetSessionObject
(
uint32_t
handle
,
uint32_t
s
ession
Id
)
{
if
(
handle
!=
0
)
{
/* transact case */
return
QueryProxySession
(
handle
);
}
else
{
/* reply case */
return
QueryStubSession
(
s
ocket
Id
);
return
QueryStubSession
(
s
ession
Id
);
}
}
...
...
@@ -176,11 +177,11 @@ static int32_t MoveTransData2Buffer(HandleSessionList *sessionObject, dbinder_tr
}
static
HandleSessionList
*
WriteTransaction
(
int
cmd
,
MessageOption
option
,
int32_t
handle
,
int32_t
s
ocket
Id
,
uint32_t
code
,
IpcIo
*
data
,
uint64_t
*
seqNumber
,
int
status
)
int32_t
s
ession
Id
,
uint32_t
code
,
IpcIo
*
data
,
uint64_t
*
seqNumber
,
int
status
)
{
HandleSessionList
*
sessionObject
=
GetSessionObject
(
handle
,
s
ocket
Id
);
HandleSessionList
*
sessionObject
=
GetSessionObject
(
handle
,
s
ession
Id
);
if
(
sessionObject
==
NULL
)
{
RPC_LOG_ERROR
(
"session is not exist for
listenFd = %d, handle = %d"
,
socket
Id
,
handle
);
RPC_LOG_ERROR
(
"session is not exist for
sessionId = %d, handle = %d"
,
session
Id
,
handle
);
return
NULL
;
}
...
...
@@ -253,7 +254,7 @@ static ThreadMessageInfo *MakeThreadMessageInfo(uint64_t seqNumber, uint32_t han
messageInfo
->
seqNumber
=
seqNumber
;
messageInfo
->
buffer
=
NULL
;
messageInfo
->
offsets
=
0
;
messageInfo
->
s
ocket
Id
=
handle
;
messageInfo
->
s
ession
Id
=
handle
;
return
messageInfo
;
}
...
...
@@ -329,16 +330,16 @@ static int32_t SendOrWaitForCompletion(int userWaitTime, uint64_t seqNumber,
return
WaitForReply
(
seqNumber
,
reply
,
sessionOfPeer
->
handle
,
userWaitTime
,
buffer
);
}
static
int32_t
GetC
lientF
d
(
void
)
static
int32_t
GetC
allerSessionI
d
(
void
)
{
ThreadContext
*
threadContext
=
GetCurrentThreadContext
();
return
threadContext
->
clientF
d
;
return
threadContext
->
sessionI
d
;
}
static
int32_t
SendReply
(
IpcIo
*
reply
,
uint32_t
flags
,
int32_t
result
)
{
uint64_t
seqNumber
=
0
;
HandleSessionList
*
sessionObject
=
WriteTransaction
(
BC_REPLY
,
flags
,
0
,
GetC
lientF
d
(),
HandleSessionList
*
sessionObject
=
WriteTransaction
(
BC_REPLY
,
flags
,
0
,
GetC
allerSessionI
d
(),
0
,
reply
,
&
seqNumber
,
result
);
if
(
seqNumber
==
0
)
{
...
...
@@ -349,7 +350,7 @@ static int32_t SendReply(IpcIo *reply, uint32_t flags, int32_t result)
return
ERR_NONE
;
}
static
void
ProcessTransaction
(
const
dbinder_transaction_data
*
tr
,
uint32_t
listenF
d
)
static
void
ProcessTransaction
(
const
dbinder_transaction_data
*
tr
,
uint32_t
sessionI
d
)
{
if
(
tr
==
NULL
||
tr
->
cookie
==
0
)
{
return
;
...
...
@@ -384,10 +385,10 @@ static void ProcessTransaction(const dbinder_transaction_data *tr, uint32_t list
RPC_LOG_ERROR
(
"stub is invalid, has not OnReceive or Request"
);
}
if
(
!
(
option
&
TF_OP_ASYNC
))
{
threadContext
->
clientFd
=
listenF
d
;
threadContext
->
sessionId
=
sessionI
d
;
threadContext
->
seqNumber
=
senderSeqNumber
;
SendReply
(
&
reply
,
0
,
result
);
threadContext
->
clientF
d
=
0
;
threadContext
->
sessionI
d
=
0
;
threadContext
->
seqNumber
=
0
;
}
...
...
@@ -398,7 +399,7 @@ static void ProcessTransaction(const dbinder_transaction_data *tr, uint32_t list
}
}
static
void
ProcessReply
(
const
dbinder_transaction_data
*
tr
,
uint32_t
listenF
d
)
static
void
ProcessReply
(
const
dbinder_transaction_data
*
tr
,
uint32_t
sessionI
d
)
{
ThreadMessageInfo
*
messageInfo
=
QueryThreadBySeqNumber
(
tr
->
seqNumber
);
if
(
messageInfo
==
NULL
)
{
...
...
@@ -412,14 +413,14 @@ static void ProcessReply(const dbinder_transaction_data *tr, uint32_t listenFd)
if
(
messageInfo
->
buffer
==
NULL
)
{
RPC_LOG_ERROR
(
"some thread is waiting for reply message, but no memory"
);
/* wake up sender thread */
WakeUpThreadBySeqNumber
(
tr
->
seqNumber
,
listenF
d
);
WakeUpThreadBySeqNumber
(
tr
->
seqNumber
,
sessionI
d
);
return
;
}
if
(
memcpy_s
(
messageInfo
->
buffer
,
bufferSize
,
tr
->
buffer
,
bufferSize
)
!=
EOK
)
{
RPC_LOG_ERROR
(
"messageInfo buffer memset failed"
);
free
(
messageInfo
->
buffer
);
WakeUpThreadBySeqNumber
(
tr
->
seqNumber
,
listenF
d
);
WakeUpThreadBySeqNumber
(
tr
->
seqNumber
,
sessionI
d
);
return
;
}
...
...
@@ -427,10 +428,10 @@ static void ProcessReply(const dbinder_transaction_data *tr, uint32_t listenFd)
messageInfo
->
bufferSize
=
tr
->
buffer_size
;
messageInfo
->
offsetsSize
=
tr
->
offsets_size
;
messageInfo
->
offsets
=
tr
->
offsets
;
messageInfo
->
s
ocketId
=
listenF
d
;
messageInfo
->
s
essionId
=
sessionI
d
;
/* wake up sender thread */
WakeUpThreadBySeqNumber
(
tr
->
seqNumber
,
listenF
d
);
WakeUpThreadBySeqNumber
(
tr
->
seqNumber
,
sessionI
d
);
}
static
void
OnTransaction
(
ThreadProcessInfo
*
processInfo
)
...
...
@@ -442,9 +443,9 @@ static void OnTransaction(ThreadProcessInfo *processInfo)
tr
->
buffer
=
(
char
*
)(
processInfo
->
buffer
+
sizeof
(
dbinder_transaction_data
));
if
(
tr
->
cmd
==
BC_TRANSACTION
)
{
ProcessTransaction
(
tr
,
processInfo
->
listenF
d
);
ProcessTransaction
(
tr
,
processInfo
->
sessionI
d
);
}
else
if
(
tr
->
cmd
==
BC_REPLY
)
{
ProcessReply
(
tr
,
processInfo
->
listenF
d
);
ProcessReply
(
tr
,
processInfo
->
sessionI
d
);
}
}
...
...
@@ -469,7 +470,7 @@ static ThreadProcessInfo *MakeThreadProcessInfo(uint32_t handle, const char *inB
free
(
processInfo
);
return
NULL
;
}
processInfo
->
listenF
d
=
handle
;
processInfo
->
sessionI
d
=
handle
;
processInfo
->
packageSize
=
size
;
return
processInfo
;
...
...
ipc/native/c/rpc/src/rpc_process_skeleton.c
浏览文件 @
ef50e2ad
...
...
@@ -438,9 +438,9 @@ void WakeUpThreadBySeqNumber(uint64_t seqNumber, uint32_t handle)
return
;
}
if
(
handle
!=
messageInfo
->
s
ocket
Id
)
{
if
(
handle
!=
messageInfo
->
s
ession
Id
)
{
RPC_LOG_ERROR
(
"error! handle is not equal messageInfo, handle = %d, messageFd = %u"
,
handle
,
messageInfo
->
s
ocket
Id
);
messageInfo
->
s
ession
Id
);
return
;
}
if
(
pthread_equal
(
messageInfo
->
threadId
,
pthread_self
())
==
0
)
{
...
...
ipc/native/c/rpc/trans_adapter/include/rpc_trans.h
浏览文件 @
ef50e2ad
...
...
@@ -34,7 +34,7 @@ typedef struct {
int32_t
(
*
Connect
)(
const
char
*
SaSessionName
,
const
char
*
peerDeviceId
,
void
*
args
);
int32_t
(
*
Disconnect
)(
int32_t
sessionId
);
int32_t
(
*
Send
)(
int32_t
sessionId
,
const
void
*
data
,
uint32_t
len
);
char
(
*
GetLocalDeviceID
)(
void
);
char
*
(
*
GetLocalDeviceID
)(
void
);
}
TransInterface
;
TransInterface
*
GetRpcTrans
(
void
);
...
...
ipc/test/rpc/samgr/rpc_samgr.c
浏览文件 @
ef50e2ad
...
...
@@ -32,6 +32,7 @@ typedef struct {
static
UTILS_DL_LIST
*
g_saList
=
NULL
;
enum
{
GET_SYSTEM_ABILITY_TRANSACTION
=
1
,
ADD_SYSTEM_ABILITY_TRANSACTION
=
2
,
GET_REMOTE_SYSTEM_ABILITY_TRANSACTION
=
3
,
ADD_REMOTE_SYSTEM_ABILITY_TRANSACTION
=
4
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录