summaryrefslogtreecommitdiffstats
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
parentcaacadcb26f1d60151040c5e83baed731479d4f8 (diff)
downloadlibimobiledevice-4b8644d16731415058376164ab20569961fec99c.tar.gz
libimobiledevice-4b8644d16731415058376164ab20569961fec99c.tar.bz2
webinspector: Use new service_client_factory_start_service()
-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
112 */ 112 */
113webinspector_error_t webinspector_client_start_service(idevice_t device, webinspector_client_t * client, const char* label) 113webinspector_error_t webinspector_client_start_service(idevice_t device, webinspector_client_t * client, const char* label)
114{ 114{
115 *client = NULL; 115 webinspector_error_t err = WEBINSPECTOR_E_UNKNOWN_ERROR;
116 116 service_client_factory_start_service(device, WEBINSPECTOR_SERVICE_NAME, (void**)client, label, SERVICE_CONSTRUCTOR(webinspector_client_new), (uint16_t*)&err);
117 lockdownd_client_t lckd = NULL; 117 return err;
118 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lckd, label)) {
119 idevice_free(device);
120 debug_info("Could not create a lockdown client.");
121 return WEBINSPECTOR_E_UNKNOWN_ERROR;
122 }
123
124 lockdownd_service_descriptor_t service = NULL;
125 lockdownd_start_service(lckd, WEBINSPECTOR_SERVICE_NAME, &service);
126 lockdownd_client_free(lckd);
127
128 if (service->port <= 0) {
129 debug_info("Could not start webinspector service!");
130 return WEBINSPECTOR_E_UNKNOWN_ERROR;
131 }
132
133 webinspector_error_t res = webinspector_client_new(device, service, client);
134 if (res != WEBINSPECTOR_E_SUCCESS) {
135 debug_info("Could not connect to webinspector! Port: %i, error: %i", service->port, res);
136 return res;
137 }
138
139 if (service) {
140 lockdownd_service_descriptor_free(service);
141 service = NULL;
142 }
143
144 return WEBINSPECTOR_E_SUCCESS;
145} 118}
146 119
147/** 120/**