Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
427354d6
A
anbox
项目概览
openeuler
/
anbox
通知
24
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
anbox
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
427354d6
编写于
8月 23, 2017
作者:
A
Alfonso Sánchez-Beato
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove now unneeded timer in AdbMessageProcessor
上级
bc131255
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
5 addition
and
25 deletion
+5
-25
src/anbox/qemu/adb_message_processor.cpp
src/anbox/qemu/adb_message_processor.cpp
+5
-24
src/anbox/qemu/adb_message_processor.h
src/anbox/qemu/adb_message_processor.h
+0
-1
未找到文件。
src/anbox/qemu/adb_message_processor.cpp
浏览文件 @
427354d6
...
...
@@ -25,13 +25,6 @@
#include <fstream>
#include <functional>
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/types.h>
namespace
{
const
unsigned
short
default_adb_client_port
{
5037
};
// For the listening port we have to use an odd port in the 5555-5585 range so
...
...
@@ -62,21 +55,19 @@ AdbMessageProcessor::AdbMessageProcessor(
state_
(
waiting_for_guest_accept_command
),
expected_command_
(
accept_command
),
messenger_
(
messenger
),
host_notify_timer_
(
rt
->
service
()),
lock_
(
active_instance_
,
std
::
defer_lock
)
{
INFO
(
"%p constructor"
,
this
);
DEBUG
(
"%p constructor"
,
this
);
}
AdbMessageProcessor
::~
AdbMessageProcessor
()
{
INFO
(
"%p destructor"
,
this
);
DEBUG
(
"%p destructor"
,
this
);
state_
=
closed_by_host
;
host_notify_timer_
.
cancel
();
host_connector_
.
reset
();
}
void
AdbMessageProcessor
::
advance_state
()
{
INFO
(
"%p [%d] state %d"
,
this
,
syscall
(
SYS_gettid
)
,
state_
);
DEBUG
(
"%p state %d"
,
this
,
state_
);
switch
(
state_
)
{
case
waiting_for_guest_accept_command
:
// Try to get a lock here as if we already have another processor
...
...
@@ -86,7 +77,6 @@ void AdbMessageProcessor::advance_state() {
lock_
.
lock
();
if
(
state_
==
closed_by_host
)
{
host_notify_timer_
.
cancel
();
host_connector_
.
reset
();
return
;
}
...
...
@@ -144,14 +134,7 @@ void AdbMessageProcessor::wait_for_host_connection() {
auto
handshake
=
utils
::
string_format
(
"%04x%s"
,
message
.
size
(),
message
.
c_str
());
messenger
->
send
(
handshake
.
data
(),
handshake
.
size
());
}
catch
(...)
{
// Try again later when the host adb service is maybe available
host_notify_timer_
.
cancel
();
host_notify_timer_
.
expires_from_now
(
default_adb_wait_time
);
host_notify_timer_
.
async_wait
([
this
](
const
boost
::
system
::
error_code
&
err
)
{
if
(
err
)
return
;
wait_for_host_connection
();
});
DEBUG
(
"%p adb host is not up yet"
,
this
);
}
}
...
...
@@ -174,8 +157,6 @@ void AdbMessageProcessor::on_host_connection(std::shared_ptr<boost::asio::basic_
}
void
AdbMessageProcessor
::
read_next_host_message
()
{
INFO
(
"%p state %d"
,
this
,
state_
);
auto
callback
=
std
::
bind
(
&
AdbMessageProcessor
::
on_host_read_size
,
this
,
_1
,
_2
);
host_messenger_
->
async_receive_msg
(
callback
,
boost
::
asio
::
buffer
(
host_buffer_
));
}
...
...
@@ -218,7 +199,7 @@ bool AdbMessageProcessor::process_data(const std::vector<std::uint8_t> &data) {
buffer_
.
size
()
>=
expected_command_
.
size
())
{
if
(
::
memcmp
(
buffer_
.
data
(),
expected_command_
.
data
(),
data
.
size
())
!=
0
)
{
// We got not the command we expected and will terminate here
INFO
(
"%p not the expected command"
,
this
);
WARNING
(
"%p not the expected command"
,
this
);
return
false
;
}
...
...
src/anbox/qemu/adb_message_processor.h
浏览文件 @
427354d6
...
...
@@ -67,7 +67,6 @@ class AdbMessageProcessor : public network::MessageProcessor {
std
::
shared_ptr
<
network
::
TcpSocketConnector
>
host_connector_
;
std
::
shared_ptr
<
network
::
TcpSocketMessenger
>
host_messenger_
;
std
::
array
<
std
::
uint8_t
,
8192
>
host_buffer_
;
boost
::
asio
::
deadline_timer
host_notify_timer_
;
std
::
unique_lock
<
std
::
mutex
>
lock_
;
static
std
::
mutex
active_instance_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录