bluez5: backend-hsphfpd: Fix transport release on disconnection

Release transport when endpoint connection property is updated to false.
This also checks if the transport is already created when receiving
endpoint properties update to prevent multiple transport creation.
This commit is contained in:
Frédéric Danis 2020-09-16 14:28:28 +02:00 committed by Wim Taymans
parent 51b6c2cbd7
commit 7c84b1251d

View file

@ -1009,6 +1009,17 @@ static DBusHandlerResult hsphfpd_parse_endpoint_properties(struct spa_bt_backend
return DBUS_HANDLER_RESULT_HANDLED;
}
if ((t = spa_bt_transport_find(backend->monitor, endpoint->path)) != NULL) {
if (!endpoint->connected) {
spa_bt_transport_free(t);
spa_bt_device_check_profiles(d, false);
spa_log_debug(backend->log, "Transport released for %s", endpoint->path);
} else
spa_log_debug(backend->log, "Transport already configured for %s", endpoint->path);
return DBUS_HANDLER_RESULT_HANDLED;
}
if (!endpoint->valid || !endpoint->connected)
return DBUS_HANDLER_RESULT_HANDLED;