summaryrefslogtreecommitdiffstats
path: root/src/webinspector.c
diff options
context:
space:
mode:
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
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/**