@@ -198,16 +198,16 @@ void cleanup_file_resources(const std::string& device_identifier, const std::str
198
198
return ;
199
199
}
200
200
201
- afc_connection* afc_connection_to_close = nullptr ;
202
201
if (devices[device_identifier].apps_cache [application_identifier].afc_connection )
203
202
{
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);
205
206
}
206
207
207
- if (afc_connection_to_close )
208
+ if (devices[device_identifier]. services . count ( kHouseArrest ) )
208
209
{
209
- AFCConnectionClose (afc_connection_to_close);
210
- devices[device_identifier].apps_cache .erase (application_identifier);
210
+ devices[device_identifier].services .erase (kHouseArrest );
211
211
}
212
212
}
213
213
@@ -355,7 +355,7 @@ HANDLE start_service(std::string device_identifier, const char* service_name, st
355
355
{
356
356
if (should_log_error)
357
357
print_error (" Device not found" , device_identifier, method_id, kAMDNotFoundError );
358
-
358
+
359
359
start_service_mutex.unlock ();
360
360
return NULL ;
361
361
}
@@ -378,7 +378,7 @@ HANDLE start_service(std::string device_identifier, const char* service_name, st
378
378
message += service_name;
379
379
if (should_log_error)
380
380
print_error (message.c_str (), device_identifier, method_id, result);
381
-
381
+
382
382
start_service_mutex.unlock ();
383
383
return NULL ;
384
384
}
@@ -1073,7 +1073,7 @@ void post_notification(std::string device_identifier, PostNotificationInfo post_
1073
1073
" <string></string>"
1074
1074
" </dict>"
1075
1075
" </plist>" ;
1076
-
1076
+
1077
1077
SOCKET socket = (SOCKET)handle;
1078
1078
send_message (xml_command.str ().c_str (), socket);
1079
1079
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
1263
1263
sockaddr_in server_address = server_socket_data->server_address ;
1264
1264
unsigned short port = ntohs (server_address.sin_port );
1265
1265
socklen_t address_length = sizeof (server_address);
1266
-
1266
+
1267
1267
// Return the host address and the port to the client.
1268
1268
print (json ({ { kHost , kLocalhostAddress }, { kPort , port }, { kId , method_id }, { kDeviceId , device_identifier } }));
1269
1269
0 commit comments