Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
183c02d2
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,发现更多精彩内容 >>
提交
183c02d2
编写于
5月 12, 2017
作者:
S
Simon Fels
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make adb message processor more robust in shutdown scenarios
上级
14d77e9c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
7 deletion
+13
-7
src/anbox/qemu/adb_message_processor.cpp
src/anbox/qemu/adb_message_processor.cpp
+13
-7
未找到文件。
src/anbox/qemu/adb_message_processor.cpp
浏览文件 @
183c02d2
...
...
@@ -16,10 +16,10 @@
*/
#include "anbox/qemu/adb_message_processor.h"
#include "anbox/logger.h"
#include "anbox/network/delegate_connection_creator.h"
#include "anbox/network/delegate_message_processor.h"
#include "anbox/network/tcp_socket_messenger.h"
#include "anbox/utils.h"
#include <fstream>
#include <functional>
...
...
@@ -54,7 +54,11 @@ AdbMessageProcessor::AdbMessageProcessor(
AdbMessageProcessor
::~
AdbMessageProcessor
()
{
state_
=
closed_by_host
;
host_notify_timer_
.
cancel
();
host_connector_
.
reset
();
// Unlock our lock to bring down any waiting instance
active_instance
.
unlock
();
}
...
...
@@ -68,6 +72,7 @@ void AdbMessageProcessor::advance_state() {
active_instance
.
lock
();
if
(
state_
==
closed_by_host
)
{
host_notify_timer_
.
cancel
();
host_connector_
.
reset
();
return
;
}
...
...
@@ -104,6 +109,9 @@ void AdbMessageProcessor::advance_state() {
}
void
AdbMessageProcessor
::
wait_for_host_connection
()
{
if
(
state_
==
closed_by_host
||
state_
==
closed_by_container
)
return
;
if
(
!
host_connector_
)
{
host_connector_
=
std
::
make_shared
<
network
::
TcpSocketConnector
>
(
boost
::
asio
::
ip
::
address_v4
::
from_string
(
loopback_address
),
...
...
@@ -121,11 +129,11 @@ void AdbMessageProcessor::wait_for_host_connection() {
auto
message
=
utils
::
string_format
(
"host:emulator:%d"
,
default_host_listen_port
);
auto
handshake
=
utils
::
string_format
(
"%04x%s"
,
message
.
size
(),
message
.
c_str
());
messenger
->
send
(
handshake
.
data
(),
handshake
.
size
());
}
catch
(
std
::
exception
&
)
{
}
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
(
[
&
](
const
boost
::
system
::
error_code
&
)
{
wait_for_host_connection
();
});
host_notify_timer_
.
async_wait
([
&
](
const
boost
::
system
::
error_code
&
)
{
wait_for_host_connection
();
});
}
}
...
...
@@ -153,11 +161,9 @@ void AdbMessageProcessor::read_next_host_message() {
boost
::
asio
::
buffer
(
host_buffer_
));
}
void
AdbMessageProcessor
::
on_host_read_size
(
const
boost
::
system
::
error_code
&
error
,
std
::
size_t
bytes_read
)
{
void
AdbMessageProcessor
::
on_host_read_size
(
const
boost
::
system
::
error_code
&
error
,
std
::
size_t
bytes_read
)
{
if
(
error
)
{
state_
=
closed_by_host
;
messenger_
->
close
();
return
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录