From dc0e7dc6e97646a1d39aeb5c4635a9bb1e0cf2de Mon Sep 17 00:00:00 2001 From: Lawrence Lomax Date: Mon, 10 Jan 2022 00:45:01 -0800 Subject: [PATCH] Fix debugserver stop Summary: For some reason the debugserver stop command called status by mistake! This means that `debugserver stop` wouldn't actually kill the debugserver. Now it does. Reviewed By: jamescoggan Differential Revision: D33479256 fbshipit-source-id: e4f6b4b85eae800d2ac8a6b275c47d68bbb398e6 --- FBDeviceControl/Management/FBDeviceDebugServer.m | 1 + idb_companion/Server/FBIDBCommandExecutor.m | 5 ++++- idb_companion/Server/FBIDBServiceHandler.mm | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/FBDeviceControl/Management/FBDeviceDebugServer.m b/FBDeviceControl/Management/FBDeviceDebugServer.m index 53ae0a9d3..bda3a307d 100644 --- a/FBDeviceControl/Management/FBDeviceDebugServer.m +++ b/FBDeviceControl/Management/FBDeviceDebugServer.m @@ -168,6 +168,7 @@ - (void)socketServer:(FBSocketServer *)server clientConnected:(struct in6_addr)a [self.logger log:@"Client Disconnected"]; self.twistedPair = nil; }]; + [self.teardown resolveFromFuture:completed]; self.twistedPair = twistedPair; } diff --git a/idb_companion/Server/FBIDBCommandExecutor.m b/idb_companion/Server/FBIDBCommandExecutor.m index 651f756af..c2d93c362 100644 --- a/idb_companion/Server/FBIDBCommandExecutor.m +++ b/idb_companion/Server/FBIDBCommandExecutor.m @@ -359,10 +359,13 @@ - (instancetype)initWithTarget:(id)target storageManager:(FBIDBStor failFuture]; } - return [[self + return [[[self debugserver_prepare:bundleID] onQueue:self.target.workQueue fmap:^(FBBundleDescriptor *application) { return [commands launchDebugServerForHostApplication:application port:self.ports.debugserverPort]; + }] + onQueue:self.target.workQueue doOnResolved:^(id debugServer) { + self.debugServer = debugServer; }]; } diff --git a/idb_companion/Server/FBIDBServiceHandler.mm b/idb_companion/Server/FBIDBServiceHandler.mm index cff35652e..24426e608 100644 --- a/idb_companion/Server/FBIDBServiceHandler.mm +++ b/idb_companion/Server/FBIDBServiceHandler.mm @@ -1507,7 +1507,7 @@ static void populate_companion_info(idb::CompanionInfo *info, id debugServer = [[_commandExecutor debugserver_status] block:&error]; + id debugServer = [[_commandExecutor debugserver_stop] block:&error]; if (!debugServer) { return Status(grpc::StatusCode::INTERNAL, error.localizedDescription.UTF8String); }