summaryrefslogtreecommitdiffstats
path: root/src/heartbeat.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2013-02-27 15:50:42 +0100
committerGravatar Martin Szulecki2013-02-27 16:18:48 +0100
commitdbe4017314f23f06301fd5017a9e888c6a604bfb (patch)
treef477c9a191b086230eaef580b564430b6c4dbf0b /src/heartbeat.c
parent63e70332393e4fb6ae275abf1e1baea0235f08e9 (diff)
downloadlibimobiledevice-dbe4017314f23f06301fd5017a9e888c6a604bfb.tar.gz
libimobiledevice-dbe4017314f23f06301fd5017a9e888c6a604bfb.tar.bz2
turn service_client_start_service into service_client_factory_start_service
Diffstat (limited to 'src/heartbeat.c')
-rw-r--r--src/heartbeat.c33
1 files changed, 3 insertions, 30 deletions
diff --git a/src/heartbeat.c b/src/heartbeat.c
index 817c6ad..0f8d2f3 100644
--- a/src/heartbeat.c
+++ b/src/heartbeat.c
@@ -112,36 +112,9 @@ heartbeat_error_t heartbeat_client_new(idevice_t device, lockdownd_service_descr
*/
heartbeat_error_t heartbeat_client_start_service(idevice_t device, heartbeat_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 HEARTBEAT_E_UNKNOWN_ERROR;
- }
-
- lockdownd_service_descriptor_t service = NULL;
- lockdownd_start_service(lckd, HEARTBEAT_SERVICE_NAME, &service);
- lockdownd_client_free(lckd);
-
- if (service->port <= 0) {
- debug_info("Could not start heartbeat service!");
- return HEARTBEAT_E_UNKNOWN_ERROR;
- }
-
- heartbeat_error_t res = heartbeat_client_new(device, service, client);
- if (res != HEARTBEAT_E_SUCCESS) {
- debug_info("Could not connect to heartbeat! Port: %i, error: %i", service->port, res);
- return res;
- }
-
- if (service) {
- lockdownd_service_descriptor_free(service);
- service = NULL;
- }
-
- return HEARTBEAT_E_SUCCESS;
+ heartbeat_error_t err = HEARTBEAT_E_UNKNOWN_ERROR;
+ service_client_factory_start_service(device, HEARTBEAT_SERVICE_NAME, (void**)client, label, SERVICE_CONSTRUCTOR(heartbeat_client_new), &err);
+ return err;
}
/**