mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	bluez5: close sco socket if bluetooth daemon disappeared
Fixes pipewire/pipewire#853
This commit is contained in:
		
							parent
							
								
									e2ac16ccbd
								
							
						
					
					
						commit
						d6be84ddd0
					
				
					 2 changed files with 13 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -1387,7 +1387,7 @@ void backend_native_register_profiles(struct spa_bt_backend *backend)
 | 
			
		|||
		sco_listen(backend);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void backend_native_unregister_profiles(struct spa_bt_backend *backend)
 | 
			
		||||
void sco_close(struct spa_bt_backend *backend)
 | 
			
		||||
{
 | 
			
		||||
	if (backend->sco.fd >= 0) {
 | 
			
		||||
		if (backend->sco.loop)
 | 
			
		||||
| 
						 | 
				
			
			@ -1396,6 +1396,11 @@ void backend_native_unregister_profiles(struct spa_bt_backend *backend)
 | 
			
		|||
		close (backend->sco.fd);
 | 
			
		||||
		backend->sco.fd = -1;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void backend_native_unregister_profiles(struct spa_bt_backend *backend)
 | 
			
		||||
{
 | 
			
		||||
	sco_close(backend);
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_BLUEZ_5_BACKEND_HSP_NATIVE
 | 
			
		||||
	if (backend->enabled_profiles & SPA_BT_PROFILE_HSP_AG)
 | 
			
		||||
| 
						 | 
				
			
			@ -1416,6 +1421,8 @@ void backend_native_free(struct spa_bt_backend *backend)
 | 
			
		|||
{
 | 
			
		||||
	struct rfcomm *rfcomm;
 | 
			
		||||
 | 
			
		||||
	sco_close(backend);
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_BLUEZ_5_BACKEND_HSP_NATIVE
 | 
			
		||||
	dbus_connection_unregister_object_path(backend->conn, PROFILE_HSP_AG);
 | 
			
		||||
	dbus_connection_unregister_object_path(backend->conn, PROFILE_HSP_HS);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2917,6 +2917,11 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
 | 
			
		|||
				spa_log_debug(monitor->log, "Bluetooth daemon disappeared");
 | 
			
		||||
				monitor->objects_listed = false;
 | 
			
		||||
 | 
			
		||||
				if (monitor->backend_native_registered) {
 | 
			
		||||
					backend_native_unregister_profiles(monitor->backend_native);
 | 
			
		||||
					monitor->backend_native_registered = false;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				spa_list_consume(t, &monitor->transport_list, link)
 | 
			
		||||
					spa_bt_transport_free(t);
 | 
			
		||||
				spa_list_consume(ep, &monitor->remote_endpoint_list, link)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue