Skip to content

Commit fcfae06

Browse files
Merge pull request #16 from telerik/vladimirov/fix-house-arrest-fail
Clean house arrest service when app is uninstalled
2 parents c317068 + 1513076 commit fcfae06

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

IOSDeviceLib/IOSDeviceLib.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,16 +198,16 @@ void cleanup_file_resources(const std::string& device_identifier, const std::str
198198
return;
199199
}
200200

201-
afc_connection* afc_connection_to_close = nullptr;
202201
if (devices[device_identifier].apps_cache[application_identifier].afc_connection)
203202
{
204-
afc_connection_to_close = devices[device_identifier].apps_cache[application_identifier].afc_connection;
203+
afc_connection* afc_connection_to_close = devices[device_identifier].apps_cache[application_identifier].afc_connection;
204+
AFCConnectionClose(afc_connection_to_close);
205+
devices[device_identifier].apps_cache.erase(application_identifier);
205206
}
206207

207-
if (afc_connection_to_close)
208+
if (devices[device_identifier].services.count(kHouseArrest))
208209
{
209-
AFCConnectionClose(afc_connection_to_close);
210-
devices[device_identifier].apps_cache.erase(application_identifier);
210+
devices[device_identifier].services.erase(kHouseArrest);
211211
}
212212
}
213213

@@ -355,7 +355,7 @@ HANDLE start_service(std::string device_identifier, const char* service_name, st
355355
{
356356
if (should_log_error)
357357
print_error("Device not found", device_identifier, method_id, kAMDNotFoundError);
358-
358+
359359
start_service_mutex.unlock();
360360
return NULL;
361361
}
@@ -378,7 +378,7 @@ HANDLE start_service(std::string device_identifier, const char* service_name, st
378378
message += service_name;
379379
if (should_log_error)
380380
print_error(message.c_str(), device_identifier, method_id, result);
381-
381+
382382
start_service_mutex.unlock();
383383
return NULL;
384384
}
@@ -1073,7 +1073,7 @@ void post_notification(std::string device_identifier, PostNotificationInfo post_
10731073
"<string></string>"
10741074
"</dict>"
10751075
"</plist>";
1076-
1076+
10771077
SOCKET socket = (SOCKET)handle;
10781078
send_message(xml_command.str().c_str(), socket);
10791079
print(json({ { kResponse, socket }, { kId, method_id }, { kDeviceId, device_identifier } }));
@@ -1263,7 +1263,7 @@ void connect_to_port(std::string device_identifier, int port, std::string method
12631263
sockaddr_in server_address = server_socket_data->server_address;
12641264
unsigned short port = ntohs(server_address.sin_port);
12651265
socklen_t address_length = sizeof(server_address);
1266-
1266+
12671267
// Return the host address and the port to the client.
12681268
print(json({ { kHost, kLocalhostAddress }, { kPort, port }, { kId, method_id }, { kDeviceId, device_identifier } }));
12691269

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ios-device-lib",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"description": "",
55
"types": "./typings/ios-device-lib.d.ts",
66
"main": "index.js",

0 commit comments

Comments
 (0)