Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
7d4d7730
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,发现更多精彩内容 >>
提交
7d4d7730
编写于
8月 23, 2017
作者:
S
Simon Fels
提交者:
GitHub
8月 23, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #419 from alfonsosanchezbeato/recover-adb-killed
Recover on adb server killed
上级
a5ead0f0
1e884a12
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
27 addition
and
15 deletion
+27
-15
external/android-emugl/host/libs/Translator/EGL/EglOsApi_glx.cpp
...l/android-emugl/host/libs/Translator/EGL/EglOsApi_glx.cpp
+4
-0
src/anbox/qemu/adb_message_processor.cpp
src/anbox/qemu/adb_message_processor.cpp
+23
-14
src/anbox/qemu/adb_message_processor.h
src/anbox/qemu/adb_message_processor.h
+0
-1
未找到文件。
external/android-emugl/host/libs/Translator/EGL/EglOsApi_glx.cpp
浏览文件 @
7d4d7730
...
...
@@ -25,6 +25,10 @@
#include <string.h>
#include <X11/Xlib.h>
#include <GL/glx.h>
#if defined(Status)
// undef to address conflict between X11 symbol and protobuf
#undef Status
#endif
namespace
{
...
...
src/anbox/qemu/adb_message_processor.cpp
浏览文件 @
7d4d7730
...
...
@@ -26,7 +26,10 @@
namespace
{
const
unsigned
short
default_adb_client_port
{
5037
};
const
unsigned
short
default_host_listen_port
{
6664
};
// For the listening port we have to use an odd port in the 5555-5585 range so
// the host can find us on start. See
// https://developer.android.com/studio/command-line/adb.html.
const
unsigned
short
default_host_listen_port
{
5559
};
constexpr
const
char
*
loopback_address
{
"127.0.0.1"
};
const
std
::
string
accept_command
{
"accept"
};
const
std
::
string
ok_command
{
"ok"
};
...
...
@@ -51,13 +54,12 @@ 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
)
{
}
lock_
(
active_instance_
,
std
::
defer_lock
)
{
}
AdbMessageProcessor
::~
AdbMessageProcessor
()
{
state_
=
closed_by_host
;
host_notify_timer_
.
cancel
();
host_connector_
.
reset
();
}
...
...
@@ -71,7 +73,6 @@ void AdbMessageProcessor::advance_state() {
lock_
.
lock
();
if
(
state_
==
closed_by_host
)
{
host_notify_timer_
.
cancel
();
host_connector_
.
reset
();
return
;
}
...
...
@@ -108,7 +109,7 @@ void AdbMessageProcessor::advance_state() {
}
void
AdbMessageProcessor
::
wait_for_host_connection
()
{
if
(
state_
==
closed_by_host
||
state_
==
closed_by_container
)
if
(
state_
!=
waiting_for_guest_accept_command
)
return
;
if
(
!
host_connector_
)
{
...
...
@@ -129,14 +130,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
();
});
// Server not up. No problem, it will contact us when started.
}
}
...
...
@@ -165,7 +159,22 @@ void AdbMessageProcessor::read_next_host_message() {
void
AdbMessageProcessor
::
on_host_read_size
(
const
boost
::
system
::
error_code
&
error
,
std
::
size_t
bytes_read
)
{
if
(
error
)
{
// When AdbMessageProcessor is destroyed on program termination, the sockets
// are closed and the standing operations are canceled. But, the callback is
// still called even in that case, and the object has already been
// deleted. We detect that condition by looking at the error code and avoid
// touching *this in that case.
if
(
error
==
boost
::
system
::
errc
::
operation_canceled
)
return
;
// For other errors, we assume the connection with the host is dropped. We
// close the connection to the container's adbd, which will trigger the
// deletion of this AdbMessageProcessor instance and free resources (most
// importantly, default_host_listen_port and the lock). The standing
// connection that adbd opened can then proceed and wait for the host to be
// up again.
state_
=
closed_by_host
;
messenger_
->
close
();
return
;
}
...
...
src/anbox/qemu/adb_message_processor.h
浏览文件 @
7d4d7730
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录