summaryrefslogtreecommitdiffstats
path: root/adb/transport.h
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2018-08-30 11:37:00 -0700
committerJosh Gao <jmgao@google.com>2018-08-30 11:37:00 -0700
commitfc2e56ffd7c59e255608a5b6783490ef28d1059c (patch)
treef33ed4f6e458e4e5762340524a5966ce63eda421 /adb/transport.h
parent5a139a0d75034acbbbc3743021d94e60f92f2a49 (diff)
downloadsystem_core-fc2e56ffd7c59e255608a5b6783490ef28d1059c.tar.gz
system_core-fc2e56ffd7c59e255608a5b6783490ef28d1059c.tar.bz2
system_core-fc2e56ffd7c59e255608a5b6783490ef28d1059c.zip
adb: don't try to reconnect emulators.
Bug: http://b/113533872 Test: ./test_adb.py Change-Id: Id591f43b487cc3928390e30f11645990e34a51bf
Diffstat (limited to 'adb/transport.h')
-rw-r--r--adb/transport.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/adb/transport.h b/adb/transport.h
index f362f241e..f854ce5c2 100644
--- a/adb/transport.h
+++ b/adb/transport.h
@@ -193,6 +193,12 @@ class ConnectionWaitable {
DISALLOW_COPY_AND_ASSIGN(ConnectionWaitable);
};
+enum class ReconnectResult {
+ Retry,
+ Success,
+ Abort,
+};
+
class atransport {
public:
// TODO(danalbert): We expose waaaaaaay too much stuff because this was
@@ -200,7 +206,7 @@ class atransport {
// class in one go is a very large change. Given how bad our testing is,
// it's better to do this piece by piece.
- using ReconnectCallback = std::function<bool(atransport*)>;
+ using ReconnectCallback = std::function<ReconnectResult(atransport*)>;
atransport(ReconnectCallback reconnect, ConnectionState state)
: id(NextTransportId()),
@@ -215,7 +221,7 @@ class atransport {
max_payload = MAX_PAYLOAD;
}
atransport(ConnectionState state = kCsOffline)
- : atransport([](atransport*) { return false; }, state) {}
+ : atransport([](atransport*) { return ReconnectResult::Abort; }, state) {}
virtual ~atransport();
int Write(apacket* p);
@@ -295,9 +301,8 @@ class atransport {
// Gets a shared reference to the ConnectionWaitable.
std::shared_ptr<ConnectionWaitable> connection_waitable() { return connection_waitable_; }
- // Attempts to reconnect with the underlying Connection. Returns true if the
- // reconnection attempt succeeded.
- bool Reconnect();
+ // Attempts to reconnect with the underlying Connection.
+ ReconnectResult Reconnect();
private:
std::atomic<bool> kicked_;