idevice_error_t idevice_disconnect(idevice_connection_t connection) { if (!connection) { return IDEVICE_E_INVALID_ARG; } /* shut down ssl if enabled */ if (connection->ssl_data) { idevice_connection_disable_ssl(connection); } idevice_error_t result = IDEVICE_E_UNKNOWN_ERROR; if (connection->type == CONNECTION_USBMUXD) { usbmuxd_disconnect((int)(long)connection->data); connection->data = NULL; result = IDEVICE_E_SUCCESS; } else { debug_info("Unknown connection type %d", connection->type); } if (connection->udid) free(connection->udid); free(connection); connection = NULL; return result; }
/** * Disconnect from the device and clean up the connection structure. * * @param connection The connection to close. * * @return IPHONE_E_SUCCESS if ok, otherwise an error code. */ iphone_error_t iphone_device_disconnect(iphone_connection_t connection) { if (!connection) { return IPHONE_E_INVALID_ARG; } iphone_error_t result = IPHONE_E_UNKNOWN_ERROR; if (connection->type == CONNECTION_USBMUXD) { usbmuxd_disconnect((int)(connection->data)); result = IPHONE_E_SUCCESS; } else { log_debug_msg("%s: Unknown connection type %d\n", __func__, connection->type); } free(connection); return result; }