Skip error handling in case of G_IO_NVAL, because the channel is invalid 34/240834/1
authorDeokhyun Kim <dukan.kim@samsung.com>
Fri, 7 Aug 2020 06:50:34 +0000 (15:50 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Wed, 12 Aug 2020 02:22:37 +0000 (11:22 +0900)
Change-Id: I554ff309e0291b2e014e8e1d88eeaf957030019f
Signed-off-by: Deokhyun Kim <dukan.kim@samsung.com>
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
bt-api/bt-gatt-service.c

index ae26396..d848399 100644 (file)
@@ -400,8 +400,13 @@ static gboolean bluetooth_gatt_write_channel_watch_cb(GIOChannel *gio,
                return FALSE;
        }
 
-       if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR)) {
-               BT_ERR("Error : GIOCondition %d, []", cond);;
+       if (cond & G_IO_NVAL) {
+               BT_ERR("Invalid channel");
+               return FALSE;
+       }
+
+       if (cond & (G_IO_HUP | G_IO_ERR)) {
+               BT_ERR("Error : GIOCondition %d", cond);
                g_io_channel_shutdown(gio, TRUE, NULL);
                g_io_channel_unref(gio);
 
@@ -3058,6 +3063,19 @@ static gboolean bluetooth_gatt_server_acquire_channel_write_cb(GIOChannel *gio,
 
        BT_DBG("FD io write data  received [%s]", write_data->address);
 
+       if (cond & G_IO_NVAL) {
+               BT_ERR("Invalid channel");
+               return FALSE;
+       }
+
+       if (cond & (G_IO_HUP | G_IO_ERR)) {
+               BT_ERR("Error : GIOCondition %d", cond);
+               g_io_channel_shutdown(gio, TRUE, NULL);
+               g_io_channel_unref(gio);
+
+               return FALSE;
+       }
+
        if (cond & G_IO_IN) {
                GIOStatus status = G_IO_STATUS_NORMAL;
                GError *err = NULL;