summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Suontausta <jarkko.suontausta@digia.com>2012-05-22 15:58:33 +0300
committerArun Raghavan <arun.raghavan@collabora.co.uk>2012-07-03 17:18:56 +0530
commit1a9a4076a2548dda75daa67db0b4f71821a98091 (patch)
tree83525fc48505e26a2b769caf59cf88087169ba5e
parent2e64edbd3e12145950ccd952bb7984a4420b8c02 (diff)
bluetooth: Release transport when the pa_rtpoll_run loop finishes.
Based on a patch by Marko Ollonen.
-rw-r--r--src/modules/bluetooth/module-bluetooth-device.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 0b12cc7b..68c4efc7 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -1731,11 +1731,18 @@ static void thread_func(void *userdata) {
pollfd->events = (short) (((u->sink && PA_SINK_IS_LINKED(u->sink->thread_info.state) && !writable) ? POLLOUT : 0) |
(u->source && PA_SOURCE_IS_LINKED(u->source->thread_info.state) ? POLLIN : 0));
- if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0)
+ if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) {
+ pa_log_debug("pa_rtpoll_run failed with: %d", ret);
goto fail;
-
- if (ret == 0)
+ }
+ if (ret == 0) {
+ pa_log_debug("IO thread shutdown requested, stopping cleanly");
+ if (u->transport)
+ bt_transport_release(u);
+ else
+ stop_stream_fd(u);
goto finish;
+ }
pollfd = u->rtpoll_item ? pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL) : NULL;