G_IO_HUP should be checked before G_IO_IN 26/241026/2
authorDeokhyun Kim <dukan.kim@samsung.com>
Fri, 3 Jul 2020 06:17:44 +0000 (15:17 +0900)
committerPyun DoHyun <dh79.pyun@samsung.com>
Thu, 20 Aug 2020 01:34:03 +0000 (01:34 +0000)
Change-Id: Id9a4ca2bd1fa59160723b831c97687df36db2d39
Signed-off-by: Deokhyun Kim <dukan.kim@samsung.com>
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
bt-api/bt-gatt-client.c
bt-api/bt-gatt-service.c

index 539f543..07daf0b 100644 (file)
@@ -2119,6 +2119,18 @@ static gboolean  bluetooth_gatt_client_notify_channel_watch_cb(GIOChannel *gio,
                BT_ERR("chr_info is invalid");
                return FALSE;
        }
+
+       if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR)) {
+               BT_ERR("Error : GIOCondition %d, [%s]", cond, chr_info->UUID);
+               g_io_channel_shutdown(gio, TRUE, NULL);
+               g_io_channel_unref(gio);
+
+               gatt_characteristic_notify_list = g_slist_remove(gatt_characteristic_notify_list, chr_info);
+               g_free(chr_info);
+
+               return FALSE;
+       }
+
        if (cond & G_IO_IN) {
                GIOStatus status = G_IO_STATUS_NORMAL;
                GError *err = NULL;
@@ -2177,17 +2189,6 @@ static gboolean  bluetooth_gatt_client_notify_channel_watch_cb(GIOChannel *gio,
                return TRUE;
        }
 
-       if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR)) {
-               BT_ERR("Error : GIOCondition %d, [%s]", cond, chr_info->UUID);
-               g_io_channel_shutdown(gio, TRUE, NULL);
-               g_io_channel_unref(gio);
-
-               gatt_characteristic_notify_list = g_slist_remove(gatt_characteristic_notify_list, chr_info);
-               g_free(chr_info);
-
-               return FALSE;
-       }
-
        return TRUE;
 }
 
index 9ba2742..c65bf82 100644 (file)
@@ -3085,22 +3085,12 @@ static gboolean bluetooth_gatt_server_acquire_channel_write_cb(GIOChannel *gio,
                        } else {
                                BT_ERR("eventinfo failed");
                        }
-
-
                }
                g_free(buffer);
 
                return TRUE;
        }
 
-       if (cond & (G_IO_NVAL | 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;
-       }
-
        return TRUE;
 }