summaryrefslogtreecommitdiff
path: root/transport.h
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2016-04-18 11:22:34 -0700
committerYabin Cui <yabinc@google.com>2016-04-18 11:22:34 -0700
commitf65e9a9fc9ce35842adb226ea94ecaff64b4b22d (patch)
tree2574a09598c2467301d7ee192ace42e1a2a34a60 /transport.h
parent783902c78d97a4659402ee9a523a8e375a01bc5f (diff)
downloadadb-f65e9a9fc9ce35842adb226ea94ecaff64b4b22d.tar.gz
Fix kick_transport test.
Fix broken kick_transport test, and make it not access atransport internal variables. Bug: 25935458 Change-Id: I91b4d32a222b2f369f801bbe3903acac9c8ea4f7
Diffstat (limited to 'transport.h')
-rw-r--r--transport.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/transport.h b/transport.h
index 5857249..35d7b50 100644
--- a/transport.h
+++ b/transport.h
@@ -60,7 +60,13 @@ public:
int (*read_from_remote)(apacket* p, atransport* t) = nullptr;
int (*write_to_remote)(apacket* p, atransport* t) = nullptr;
void (*close)(atransport* t) = nullptr;
- void (*kick)(atransport* t) = nullptr;
+ void SetKickFunction(void (*kick_func)(atransport*)) {
+ kick_func_ = kick_func;
+ }
+ bool IsKicked() {
+ return kicked_;
+ }
+ void Kick();
int fd = -1;
int transport_socket = -1;
@@ -82,7 +88,6 @@ public:
char* device = nullptr;
char* devpath = nullptr;
int adb_port = -1; // Use for emulators (local transport)
- bool kicked = false;
void* key = nullptr;
unsigned char token[TOKEN_SIZE] = {};
@@ -123,6 +128,9 @@ public:
bool MatchesTarget(const std::string& target) const;
private:
+ bool kicked_ = false;
+ void (*kick_func_)(atransport*) = nullptr;
+
// A set of features transmitted in the banner with the initial connection.
// This is stored in the banner as 'features=feature0,feature1,etc'.
FeatureSet features_;