Skip to contentSkip to conversation

android/pan: shutdown io channel on disconnect call

PATCH New Ravi kumar Veeramally 1 participant 1 message Dec 19, 2013 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 android/pan: shutdown io channel on disconnect call

Shutdown io channel and send DISCONNECTING notification and send DISCONNECTED notification and free the device on callback.

---
 android/pan.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
android/pan.c +8 -6
index b83f534..187953b 100644
@@ -284,14 +284,16 @@ static void bt_pan_disconnect(const void *buf, uint16_t len)
 	}
 
 	dev = l->data;
-	if (dev->watch) {
-		g_source_remove(dev->watch);
-		dev->watch = 0;
+
+	if (dev->io)
+		g_io_channel_shutdown(dev->io, TRUE, NULL);
+
+	if (dev->conn_state == HAL_PAN_STATE_CONNECTED) {
+		bnep_if_down(dev->iface);
+		bnep_conndel(&dst);
 	}
 
-	bnep_if_down(dev->iface);
-	bnep_conndel(&dst);
-	bt_pan_notify_conn_state(dev, HAL_PAN_STATE_DISCONNECTED);
+	bt_pan_notify_conn_state(dev, HAL_PAN_STATE_DISCONNECTING);
 	status = HAL_STATUS_SUCCESS;
 
 failed:
Signature · 1 line
1.8.3.2