Skip to content

Commit 5756a5d

Browse files
Merge pull request #25 from telerik/milanov/do-not-cache-the-notification-service
Don't cache the notification proxy service
2 parents 0e811ad + a972b21 commit 5756a5d

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

IOSDeviceLib/CommonFunctions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "Declarations.h"
88

99
inline bool has_complete_status(std::map<std::string, boost::any>& dict);
10-
HANDLE start_service(std::string device_identifier, const char* service_name, std::string method_id, bool should_log_error = true);
10+
HANDLE start_service(std::string device_identifier, const char* service_name, std::string method_id, bool should_log_error = true, bool skip_cache = false);
1111
bool mount_image(std::string& device_identifier, std::string& image_path, std::string& method_id);
1212
std::string get_device_property_value(std::string& device_identifier, const char* property_name);
1313
int start_session(std::string& device_identifier);

IOSDeviceLib/IOSDeviceLib.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ void start_run_loop()
350350
}
351351

352352
std::mutex start_service_mutex;
353-
HANDLE start_service(std::string device_identifier, const char* service_name, std::string method_id, bool should_log_error)
353+
HANDLE start_service(std::string device_identifier, const char* service_name, std::string method_id, bool should_log_error, bool skip_cache)
354354
{
355355
start_service_mutex.lock();
356356
if (!devices.count(device_identifier))
@@ -385,7 +385,9 @@ HANDLE start_service(std::string device_identifier, const char* service_name, st
385385
return NULL;
386386
}
387387

388-
devices[device_identifier].services[service_name] = socket;
388+
if (!skip_cache) {
389+
devices[device_identifier].services[service_name] = socket;
390+
}
389391

390392
start_service_mutex.unlock();
391393
return socket;
@@ -1058,7 +1060,7 @@ void device_log(std::string device_identifier, std::string method_id)
10581060

10591061
void post_notification(std::string device_identifier, PostNotificationInfo post_notification_info, std::string method_id)
10601062
{
1061-
HANDLE handle = start_service(device_identifier, kNotificationProxy, method_id);
1063+
HANDLE handle = start_service(device_identifier, kNotificationProxy, method_id, true, true);
10621064
if (!handle)
10631065
{
10641066
return;

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.9",
3+
"version": "0.4.10",
44
"description": "",
55
"types": "./typings/ios-device-lib.d.ts",
66
"main": "index.js",

0 commit comments

Comments
 (0)