Diff between 226a06430538d4423f0415fde306655d5b97a4c3 and af39e81ae92ed117719a77017adf2bb6b2dc5046

Changed Files

File Additions Deletions Status
src/adapter.c +4 -2 modified

Full Patch

diff --git a/src/adapter.c b/src/adapter.c
index 2695289..3c23971 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -508,7 +508,8 @@ static void stop_discovery(struct btd_adapter *adapter)
 		return;
 	}
 
-	adapter_ops->stop_discovery(adapter->dev_id);
+	if (adapter->up)
+		adapter_ops->stop_discovery(adapter->dev_id);
 }
 
 static void session_remove(struct session_req *req)
@@ -2290,6 +2291,8 @@ int btd_adapter_stop(struct btd_adapter *adapter)
 	/* check pending requests */
 	reply_pending_requests(adapter);
 
+	adapter->up = FALSE;
+
 	stop_discovery(adapter);
 
 	if (adapter->disc_sessions) {
@@ -2320,7 +2323,6 @@ int btd_adapter_stop(struct btd_adapter *adapter)
 	emit_property_changed(connection, adapter->path, ADAPTER_INTERFACE,
 				"Powered", DBUS_TYPE_BOOLEAN, &prop_false);
 
-	adapter->up = FALSE;
 	adapter->scan_mode = SCAN_DISABLED;
 	adapter->mode = MODE_OFF;
 	adapter->off_requested = FALSE;