Loading libs/adbd_auth/adbd_auth.cpp +0 −2 Original line number Diff line number Diff line Loading @@ -151,8 +151,6 @@ void AdbdAuthContext::HandlePacket(std::string_view packet) EXCLUDES(mutex_) { } if (!handled_packet) { LOG(ERROR) << "adbd_auth: unhandled packet: " << packet; std::lock_guard<std::mutex> lock(mutex_); ReplaceFrameworkFd(unique_fd()); } } Loading libs/adbd_auth/adbd_auth_test.cpp +23 −1 Original line number Diff line number Diff line Loading @@ -137,7 +137,7 @@ class Framework { auto packet_id = runner->Context()->ReceivedPackets(); Send(msg); while(runner->Context()->ReceivedPackets() < packet_id + 1) { while(runner->Context()->ReceivedPackets() == packet_id) { std::this_thread::sleep_for(10ms); } } Loading Loading @@ -252,3 +252,25 @@ TEST(AdbAuthTest, WifiLifeCycle) { framework.SendAndWaitContext("W0", runner.get()); ASSERT_EQ(stop_message_received,true); } TEST(AdbAuthTest, UnhandledPacket) { AdbdAuthCallbacksV2 callbacks{}; callbacks.version = 2; auto runner= CreateContextRunner(callbacks); Framework framework{}; uint16_t port = 19; adbd_auth_send_tls_server_port(runner->Context(), port); // Send an unhandled packet. This should not reset the stack. framework.SendAndWaitContext("XX", runner.get()); // Check that libauth did not reset the socket. auto msg = framework.Recv(); ASSERT_EQ(4, msg.size()); ASSERT_EQ(msg[0], 'T'); ASSERT_EQ(msg[1], 'P'); ASSERT_EQ(msg[2], port); ASSERT_EQ(msg[3], 0); } Loading
libs/adbd_auth/adbd_auth.cpp +0 −2 Original line number Diff line number Diff line Loading @@ -151,8 +151,6 @@ void AdbdAuthContext::HandlePacket(std::string_view packet) EXCLUDES(mutex_) { } if (!handled_packet) { LOG(ERROR) << "adbd_auth: unhandled packet: " << packet; std::lock_guard<std::mutex> lock(mutex_); ReplaceFrameworkFd(unique_fd()); } } Loading
libs/adbd_auth/adbd_auth_test.cpp +23 −1 Original line number Diff line number Diff line Loading @@ -137,7 +137,7 @@ class Framework { auto packet_id = runner->Context()->ReceivedPackets(); Send(msg); while(runner->Context()->ReceivedPackets() < packet_id + 1) { while(runner->Context()->ReceivedPackets() == packet_id) { std::this_thread::sleep_for(10ms); } } Loading Loading @@ -252,3 +252,25 @@ TEST(AdbAuthTest, WifiLifeCycle) { framework.SendAndWaitContext("W0", runner.get()); ASSERT_EQ(stop_message_received,true); } TEST(AdbAuthTest, UnhandledPacket) { AdbdAuthCallbacksV2 callbacks{}; callbacks.version = 2; auto runner= CreateContextRunner(callbacks); Framework framework{}; uint16_t port = 19; adbd_auth_send_tls_server_port(runner->Context(), port); // Send an unhandled packet. This should not reset the stack. framework.SendAndWaitContext("XX", runner.get()); // Check that libauth did not reset the socket. auto msg = framework.Recv(); ASSERT_EQ(4, msg.size()); ASSERT_EQ(msg[0], 'T'); ASSERT_EQ(msg[1], 'P'); ASSERT_EQ(msg[2], port); ASSERT_EQ(msg[3], 0); }