[gnome-network-displays/cc-tmp: 55/80] cc: do the check the proper way




commit 0b9283ccccf66e572140b3ecd7237d062d9c74be
Author: Anupam Kumar <kyteinsky gmail com>
Date:   Mon Sep 5 17:53:02 2022 +0530

    cc: do the check the proper way

 src/cc/cc-comm.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/src/cc/cc-comm.c b/src/cc/cc-comm.c
index a9e2a3b..49b64ab 100644
--- a/src/cc/cc-comm.c
+++ b/src/cc/cc-comm.c
@@ -102,11 +102,6 @@ cc_comm_message_read_cb (GObject      *source_object,
                          GAsyncResult *res,
                          gpointer      user_data)
 {
-  CcComm * comm = (CcComm *) user_data;
-
-  if (g_cancellable_is_cancelled (comm->cancellable))
-    return;
-
   g_autoptr(GError) error = NULL;
   gboolean success;
   gsize io_bytes;
@@ -116,6 +111,8 @@ cc_comm_message_read_cb (GObject      *source_object,
   if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
     return;
 
+  CcComm * comm = (CcComm *) user_data;
+
   if (!comm->con)
     {
       g_error ("CcComm: Connection error while reading message body");
@@ -155,11 +152,6 @@ cc_comm_header_read_cb (GObject      *source_object,
                         GAsyncResult *res,
                         gpointer      user_data)
 {
-  CcComm *comm = (CcComm *) user_data;
-
-  if (g_cancellable_is_cancelled (comm->cancellable))
-    return;
-
   g_autoptr(GError) error = NULL;
   gboolean success;
   gsize io_bytes;
@@ -170,6 +162,8 @@ cc_comm_header_read_cb (GObject      *source_object,
   if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
     return;
 
+  CcComm *comm = (CcComm *) user_data;
+
   if (!comm->con)
     {
       g_error ("CcComm: Connection error while reading header");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]