summaryrefslogtreecommitdiffstats
path: root/src/webinspector.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2013-02-27 16:27:54 +0100
committerGravatar Martin Szulecki2013-02-27 16:27:54 +0100
commit4b8644d16731415058376164ab20569961fec99c (patch)
treea16b5a744ef54124ba30a0f293e36c6180f37263 /src/webinspector.c
parentcaacadcb26f1d60151040c5e83baed731479d4f8 (diff)
downloadlibimobiledevice-4b8644d16731415058376164ab20569961fec99c.tar.gz
libimobiledevice-4b8644d16731415058376164ab20569961fec99c.tar.bz2
webinspector: Use new service_client_factory_start_service()
Diffstat (limited to 'src/webinspector.c')
-rw-r--r--src/webinspector.c33
1 files changed, 3 insertions, 30 deletions
diff --git a/src/webinspector.c b/src/webinspector.c
index 8d05082..40ce7dd 100644
--- a/src/webinspector.c
+++ b/src/webinspector.c
@@ -112,36 +112,9 @@ webinspector_error_t webinspector_client_new(idevice_t device, lockdownd_service
*/
webinspector_error_t webinspector_client_start_service(idevice_t device, webinspector_client_t * client, const char* label)
{
- *client = NULL;
-
- lockdownd_client_t lckd = NULL;
- if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lckd, label)) {
- idevice_free(device);
- debug_info("Could not create a lockdown client.");
- return WEBINSPECTOR_E_UNKNOWN_ERROR;
- }
-
- lockdownd_service_descriptor_t service = NULL;
- lockdownd_start_service(lckd, WEBINSPECTOR_SERVICE_NAME, &service);
- lockdownd_client_free(lckd);
-
- if (service->port <= 0) {
- debug_info("Could not start webinspector service!");
- return WEBINSPECTOR_E_UNKNOWN_ERROR;
- }
-
- webinspector_error_t res = webinspector_client_new(device, service, client);
- if (res != WEBINSPECTOR_E_SUCCESS) {
- debug_info("Could not connect to webinspector! Port: %i, error: %i", service->port, res);
- return res;
- }
-
- if (service) {
- lockdownd_service_descriptor_free(service);
- service = NULL;
- }
-
- return WEBINSPECTOR_E_SUCCESS;
+ webinspector_error_t err = WEBINSPECTOR_E_UNKNOWN_ERROR;
+ service_client_factory_start_service(device, WEBINSPECTOR_SERVICE_NAME, (void**)client, label, SERVICE_CONSTRUCTOR(webinspector_client_new), (uint16_t*)&err);
+ return err;
}
/**