Skip to content

Don't cache the notification proxy service #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion IOSDeviceLib/CommonFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "Declarations.h"

inline bool has_complete_status(std::map<std::string, boost::any>& dict);
HANDLE start_service(std::string device_identifier, const char* service_name, std::string method_id, bool should_log_error = true);
HANDLE start_service(std::string device_identifier, const char* service_name, std::string method_id, bool should_log_error = true, bool skip_cache = false);
bool mount_image(std::string& device_identifier, std::string& image_path, std::string& method_id);
std::string get_device_property_value(std::string& device_identifier, const char* property_name);
int start_session(std::string& device_identifier);
Expand Down
8 changes: 5 additions & 3 deletions IOSDeviceLib/IOSDeviceLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ void start_run_loop()
}

std::mutex start_service_mutex;
HANDLE start_service(std::string device_identifier, const char* service_name, std::string method_id, bool should_log_error)
HANDLE start_service(std::string device_identifier, const char* service_name, std::string method_id, bool should_log_error, bool skip_cache)
{
start_service_mutex.lock();
if (!devices.count(device_identifier))
Expand Down Expand Up @@ -385,7 +385,9 @@ HANDLE start_service(std::string device_identifier, const char* service_name, st
return NULL;
}

devices[device_identifier].services[service_name] = socket;
if (!skip_cache) {
devices[device_identifier].services[service_name] = socket;
}

start_service_mutex.unlock();
return socket;
Expand Down Expand Up @@ -1058,7 +1060,7 @@ void device_log(std::string device_identifier, std::string method_id)

void post_notification(std::string device_identifier, PostNotificationInfo post_notification_info, std::string method_id)
{
HANDLE handle = start_service(device_identifier, kNotificationProxy, method_id);
HANDLE handle = start_service(device_identifier, kNotificationProxy, method_id, true, true);
if (!handle)
{
return;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ios-device-lib",
"version": "0.4.9",
"version": "0.4.10",
"description": "",
"types": "./typings/ios-device-lib.d.ts",
"main": "index.js",
Expand Down