return SR_ERR_BUG;
}
- g_slist_free(session->devs);
- session->devs = NULL;
+ sr_session_dev_remove_all();
/* TODO: Error checks needed? */
return SR_OK;
}
+static void sr_dev_close(struct sr_dev *dev)
+{
+ if (dev && dev->driver && dev->driver->dev_close)
+ dev->driver->dev_close(dev->driver_index);
+}
+
/**
* Remove all the devices from the current session. TODO?
*
return SR_ERR_BUG;
}
- g_slist_free(session->devs);
+ g_slist_free_full(session->devs, (GDestroyNotify)sr_dev_close);
session->devs = NULL;
return SR_OK;
/**
* Halt the current session.
*
- * This requests the current session be stopped as soon as possible, for
- * example on receiving an SR_DF_END packet.
+ * This function is deprecated and should not be used in new code, use
+ * sr_session_stop() instead. The behaviour of this function is identical to
+ * sr_session_stop().
*
* @return SR_OK upon success, SR_ERR_BUG if no session exists.
*/
SR_API int sr_session_halt(void)
{
- if (!session) {
- sr_err("session: %s: session was NULL", __func__);
- return SR_ERR_BUG;
- }
-
- sr_info("session: halting");
- session->running = FALSE;
-
- return SR_OK;
+ return sr_session_stop();
}
/**
if (dev->driver) {
if (dev->driver->dev_acquisition_stop)
dev->driver->dev_acquisition_stop(dev->driver_index, dev);
- if (dev->driver->cleanup)
- dev->driver->cleanup();
}
}