[svn r823] fixed monitor_handler dispose trunk
authorrenatofilho
Tue Aug 21 20:04:23 2007 +0100 (2007-08-21)
branchtrunk
changeset 817888b9724f601
parent 816 c404781fda4e
child 818 6001f33507b4
[svn r823] fixed monitor_handler dispose
gmyth/src/gmyth_backendinfo.c
gmyth/src/gmyth_file_transfer.c
gmyth/src/gmyth_livetv.c
gmyth/src/gmyth_monitor_handler.c
gmyth/src/gmyth_monitor_handler.h
gmyth/src/gmyth_socket.c
     1.1 --- a/gmyth/src/gmyth_backendinfo.c	Tue Aug 21 17:14:42 2007 +0100
     1.2 +++ b/gmyth/src/gmyth_backendinfo.c	Tue Aug 21 20:04:23 2007 +0100
     1.3 @@ -73,7 +73,9 @@
     1.4      g_free(backend_info->username);
     1.5      g_free(backend_info->password);
     1.6      g_free(backend_info->db_name);
     1.7 -    g_object_unref (backend_info->sock);
     1.8 +
     1.9 +    if (backend_info->sock)
    1.10 +        g_object_unref (backend_info->sock);
    1.11  
    1.12      backend_info->hostname = NULL;
    1.13      backend_info->username = NULL;
    1.14 @@ -81,6 +83,7 @@
    1.15      backend_info->db_name = NULL;
    1.16      backend_info->port = -1;
    1.17      backend_info->status_port = -1;
    1.18 +    backend_info->sock = NULL;
    1.19  
    1.20      G_OBJECT_CLASS(gmyth_backend_info_parent_class)->dispose(object);
    1.21  }
     2.1 --- a/gmyth/src/gmyth_file_transfer.c	Tue Aug 21 17:14:42 2007 +0100
     2.2 +++ b/gmyth/src/gmyth_file_transfer.c	Tue Aug 21 20:04:23 2007 +0100
     2.3 @@ -142,8 +142,8 @@
     2.4  
     2.5      g_signal_connect(G_OBJECT(transfer), "program-info-changed",
     2.6                       (GCallback) (GMYTH_FILE_TRANSFER_GET_CLASS
     2.7 -                                  (transfer)->
     2.8 -                                  program_info_changed_handler), NULL);
     2.9 +                         (transfer)->program_info_changed_handler),
    2.10 +                         NULL);
    2.11  }
    2.12  
    2.13  static void
     3.1 --- a/gmyth/src/gmyth_livetv.c	Tue Aug 21 17:14:42 2007 +0100
     3.2 +++ b/gmyth/src/gmyth_livetv.c	Tue Aug 21 20:04:23 2007 +0100
     3.3 @@ -109,12 +109,12 @@
     3.4          livetv->monitor = NULL;
     3.5      }
     3.6  
     3.7 +
     3.8      if (livetv->file != NULL) {
     3.9          g_object_unref(livetv->file);
    3.10          livetv->file = NULL;
    3.11      }
    3.12  
    3.13 -
    3.14      if (livetv->recorder != NULL) {
    3.15          // gmyth_recorder_close(livetv->recorder);
    3.16          g_object_unref(livetv->recorder);
    3.17 @@ -131,7 +131,6 @@
    3.18          livetv->tvchain = NULL;
    3.19      }
    3.20  
    3.21 -
    3.22      if (livetv->proginfo != NULL) {
    3.23          g_object_unref(livetv->proginfo);
    3.24          livetv->proginfo = NULL;
    3.25 @@ -142,7 +141,6 @@
    3.26          livetv->backend_info = NULL;
    3.27      }
    3.28  
    3.29 -
    3.30      if (livetv->uri != NULL) {
    3.31          g_object_unref(livetv->uri);
    3.32          livetv->uri = NULL;
    3.33 @@ -153,7 +151,6 @@
    3.34          livetv->mutex = NULL;
    3.35      }
    3.36  
    3.37 -
    3.38      if (livetv->local_hostname != NULL) {
    3.39          g_string_free(livetv->local_hostname, TRUE);
    3.40          livetv->local_hostname = NULL;
    3.41 @@ -321,7 +318,6 @@
    3.42      }
    3.43  
    3.44      livetv->monitor = gmyth_monitor_handler_new();
    3.45 -
    3.46      res =
    3.47          gmyth_monitor_handler_open(livetv->monitor,
    3.48                                     livetv->backend_info->hostname,
    3.49 @@ -403,9 +399,8 @@
    3.50  
    3.51      g_return_val_if_fail(livetv != NULL, FALSE);
    3.52  
    3.53 -    if (NULL == livetv->socket) {
    3.54 +    if (livetv->socket == NULL) {
    3.55          livetv->socket = gmyth_socket_new();
    3.56 -
    3.57          /*
    3.58           * FIME: Implement this at gmyth_socket 
    3.59           */
     4.1 --- a/gmyth/src/gmyth_monitor_handler.c	Tue Aug 21 17:14:42 2007 +0100
     4.2 +++ b/gmyth/src/gmyth_monitor_handler.c	Tue Aug 21 20:04:23 2007 +0100
     4.3 @@ -70,7 +70,9 @@
     4.4  #define GMYTHTV_ENABLE_DEBUG				1
     4.5  #endif
     4.6  
     4.7 -gpointer        gmyth_monitor_handler_listener(gpointer data);
     4.8 +gboolean        gmyth_monitor_handler_listener  (GIOChannel *io_channel,
     4.9 +                                                 GIOCondition condition,
    4.10 +                                                 gpointer data);
    4.11  
    4.12  static void     gmyth_monitor_handler_default_listener(GMythMonitorHandler
    4.13                                                         * monitor,
    4.14 @@ -92,51 +94,10 @@
    4.15  
    4.16  void            gmyth_monitor_handler_close(GMythMonitorHandler * monitor);
    4.17  
    4.18 -G_DEFINE_TYPE(GMythMonitorHandler, gmyth_monitor_handler, G_TYPE_OBJECT)
    4.19 -    static void
    4.20 +G_DEFINE_TYPE(GMythMonitorHandler, gmyth_monitor_handler, G_TYPE_OBJECT);
    4.21  
    4.22 -
    4.23 -
    4.24 -
    4.25 -
    4.26 -
    4.27 -
    4.28 -
    4.29 -
    4.30 -
    4.31 -
    4.32 -
    4.33 -
    4.34 -
    4.35 -
    4.36 -
    4.37 -
    4.38 -
    4.39 -
    4.40 -
    4.41 -
    4.42 -
    4.43 -
    4.44 -
    4.45 -
    4.46 -
    4.47 -
    4.48 -
    4.49 -     
    4.50 -        
    4.51 -        
    4.52 -        
    4.53 -        
    4.54 -        
    4.55 -        
    4.56 -        
    4.57 -        
    4.58 -        
    4.59 -        
    4.60 -        
    4.61 -        
    4.62 -        
    4.63 -         gmyth_monitor_handler_class_init(GMythMonitorHandlerClass * klass)
    4.64 +static void
    4.65 +gmyth_monitor_handler_class_init(GMythMonitorHandlerClass * klass)
    4.66  {
    4.67      GObjectClass   *gobject_class;
    4.68      GMythMonitorHandlerClass *gmonitor_class;
    4.69 @@ -169,23 +130,11 @@
    4.70      monitor->hostname = NULL;
    4.71      monitor->port = 0;
    4.72      monitor->actual_index = 0;
    4.73 -
    4.74      monitor->allow_msgs_listener = FALSE;
    4.75 -
    4.76 -    /*
    4.77 -     * monitor->backend_msgs = g_hash_table_new( g_int_hash, g_int_equal
    4.78 -     * ); 
    4.79 -     */
    4.80 -
    4.81      /*
    4.82       * it is used for signalizing the event socket consumer thread 
    4.83       */
    4.84      monitor->mutex = g_mutex_new();
    4.85 -
    4.86 -    monitor->th = NULL;
    4.87 -
    4.88 -    monitor->gmyth_monitor_handler_listener =
    4.89 -        gmyth_monitor_handler_listener;
    4.90  }
    4.91  
    4.92  static void
    4.93 @@ -197,14 +146,9 @@
    4.94  
    4.95      monitor->allow_msgs_listener = FALSE;
    4.96  
    4.97 -    if (monitor->th != NULL) {
    4.98 -        gboolean       *ret = (gboolean *) g_thread_join(monitor->th);
    4.99 -
   4.100 -        if (*ret == FALSE)
   4.101 -            gmyth_debug("Error closing GThread listener socket!");
   4.102 -        else
   4.103 -            gmyth_debug("Closed GThread listener socket.");
   4.104 -        // g_object_unref( monitor->th );
   4.105 +    if (monitor->io_source != 0) {
   4.106 +        g_source_remove (monitor->io_source);
   4.107 +        monitor->io_source = 0;
   4.108      }
   4.109  
   4.110      /*
   4.111 @@ -226,6 +170,7 @@
   4.112          monitor->hostname = NULL;
   4.113      }
   4.114  
   4.115 +
   4.116      if (monitor->backend_msgs != NULL) {
   4.117          g_hash_table_destroy(monitor->backend_msgs);
   4.118          monitor->backend_msgs = NULL;
   4.119 @@ -236,6 +181,7 @@
   4.120       * io_watcher_cond = NULL; } 
   4.121       */
   4.122  
   4.123 +
   4.124      G_OBJECT_CLASS(gmyth_monitor_handler_parent_class)->dispose(object);
   4.125  }
   4.126  
   4.127 @@ -353,30 +299,22 @@
   4.128      gmyth_debug("Monitor event socket --- hostname: %s, port %d\n",
   4.129                  monitor->hostname, monitor->port);
   4.130  
   4.131 -    if (NULL != monitor->event_sock) {
   4.132 +    if (monitor->event_sock != NULL) {
   4.133          g_object_unref(monitor->event_sock);
   4.134          monitor->event_sock = NULL;
   4.135      }
   4.136  
   4.137      /*
   4.138 -     * configure the event socket 
   4.139 +     * configure the event socket
   4.140       */
   4.141 -    if (NULL == monitor->event_sock) {
   4.142 -        if (!gmyth_connect_to_backend_monitor(monitor)) {
   4.143 -            gmyth_debug("Connection to backend failed (Event Socket)!");
   4.144 -            ret = FALSE;
   4.145 -        } else {
   4.146 -            gmyth_debug
   4.147 -                ("Remote monitor event socket had been succesfully created. (io_fd == %d)\n",
   4.148 -                 g_io_channel_unix_get_fd(monitor->event_sock->sd_io_ch));
   4.149 -        }
   4.150 +    if (!gmyth_connect_to_backend_monitor(monitor)) {
   4.151 +        gmyth_debug("Connection to backend failed (Event Socket)!");
   4.152 +        ret = FALSE;
   4.153      } else {
   4.154 -        gmyth_debug
   4.155 -            ("ASSERT ERROR: Remote monitor event socket is not NULL at the setup...\n");
   4.156 +        gmyth_debug ("Remote monitor event socket had been succesfully create");
   4.157      }
   4.158  
   4.159      return ret;
   4.160 -
   4.161  }
   4.162  
   4.163  /** 
   4.164 @@ -493,122 +431,73 @@
   4.165   * @return Pointer to a gboolean <code>true</code> value, if the data was 
   4.166   * 	successfully read.
   4.167   */
   4.168 -gpointer
   4.169 -gmyth_monitor_handler_listener(gpointer data)
   4.170 +gboolean
   4.171 +gmyth_monitor_handler_listener (GIOChannel *io_channel,
   4.172 +                                GIOCondition io_cond,
   4.173 +                                gpointer data)
   4.174  {
   4.175 -    GMythMonitorHandler *monitor = (GMythMonitorHandler *) data;
   4.176 +    GMythMonitorHandler *monitor;
   4.177      guint           recv = 0;
   4.178 -    gboolean       *ret = g_new0(gboolean, 1);
   4.179      gsize           len = 0;
   4.180 -    GIOChannel     *io_channel = monitor->event_sock->sd_io_ch;
   4.181 -    GIOCondition    io_cond =
   4.182 -        g_io_channel_get_buffer_condition(io_channel);
   4.183 -    static guint    count = 0;
   4.184 +    GMythStringList *strlist = NULL;
   4.185 +    gint bytes_sent = 0;
   4.186  
   4.187 -    *ret = TRUE;
   4.188 +    monitor = (GMythMonitorHandler *) data;
   4.189  
   4.190      gmyth_debug("Entering MONITOR handler listener...");
   4.191  
   4.192      myth_control_acquire_context(monitor, TRUE);
   4.193  
   4.194 -    if ((io_cond & G_IO_HUP) != 0) {
   4.195 -        *ret = FALSE;
   4.196 +    if (((io_cond & G_IO_HUP) != 0) ||
   4.197 +        ((io_cond & G_IO_ERR) != 0)) {
   4.198          goto clean_up;
   4.199      }
   4.200  
   4.201 -    GMythStringList *strlist = NULL;
   4.202  
   4.203 -    if (NULL == io_channel) {
   4.204 -        gmyth_debug("Monitor socket is NULL! (GIOChannel)");
   4.205 -        *ret = FALSE;
   4.206 -        goto clean_up;
   4.207 +    gmyth_debug("%d - Listening on Monitor socket...!\n", count);
   4.208 +    strlist = gmyth_string_list_new();
   4.209 +
   4.210 +    len = gmyth_socket_read_stringlist(monitor->event_sock, strlist);
   4.211 +    if ((len > 0) && strlist != NULL && gmyth_string_list_length(strlist) > 0) {
   4.212 +        gchar *back_msg_action;
   4.213 +        gint msg_type;
   4.214 +
   4.215 +        bytes_sent = gmyth_string_list_get_int(strlist, 0);
   4.216 +        // on  backend  error
   4.217 +        gmyth_debug ("received data buffer from IO event channel... %d strings gone!\n", len);
   4.218 +        recv += len;
   4.219 +
   4.220 +        /*
   4.221 +         * debug purpose: prints out all the string list
   4.222 +         * elements
   4.223 +         */
   4.224 +        g_list_foreach(strlist->glist,
   4.225 +                       (GFunc) gmyth_monitor_handler_print,
   4.226 +                       NULL);
   4.227 +
   4.228 +         back_msg_action = g_new0(gchar, 1);
   4.229 +         msg_type = gmyth_monitor_handler_is_backend_message(monitor,
   4.230 +            strlist,
   4.231 +            &back_msg_action);
   4.232 +
   4.233 +        if (msg_type != GMYTH_BACKEND_NO_MESSAGE) {
   4.234 +            g_signal_emit(monitor,
   4.235 +                          GMYTH_MONITOR_HANDLER_GET_CLASS(monitor)->backend_events_handler_signal_id,
   4.236 +                          0, msg_type, back_msg_action);
   4.237 +        }
   4.238 +
   4.239 +        if (back_msg_action != NULL)
   4.240 +            g_free(back_msg_action);
   4.241 +
   4.242 +        g_object_unref(strlist);
   4.243      }
   4.244  
   4.245 -    while (monitor->allow_msgs_listener) {
   4.246 -        ++count;
   4.247 -
   4.248 -        gmyth_debug("%d - Listening on Monitor socket...!\n", count);
   4.249 -
   4.250 -        do {
   4.251 -
   4.252 -            gint            bytes_sent = 0;
   4.253 -
   4.254 -            strlist = gmyth_string_list_new();
   4.255 -
   4.256 -            if (monitor->event_sock != NULL) {
   4.257 -
   4.258 -                len =
   4.259 -                    gmyth_socket_read_stringlist(monitor->event_sock,
   4.260 -                                                 strlist);
   4.261 -
   4.262 -                if ((len > 0) && strlist != NULL
   4.263 -                    && gmyth_string_list_length(strlist) > 0) {
   4.264 -                    bytes_sent = gmyth_string_list_get_int(strlist, 0); // -1 
   4.265 -                                                                        // 
   4.266 -                    // 
   4.267 -                    // on 
   4.268 -                    // backend 
   4.269 -                    // error
   4.270 -
   4.271 -                    gmyth_debug
   4.272 -                        ("[%s] MONITOR: received data buffer from IO event channel... %d strings gone!\n",
   4.273 -                         __FUNCTION__, len);
   4.274 -
   4.275 -                    recv += len;
   4.276 -
   4.277 -                    /*
   4.278 -                     * debug purpose: prints out all the string list
   4.279 -                     * elements 
   4.280 -                     */
   4.281 -                    g_list_foreach(strlist->glist,
   4.282 -                                   (GFunc) gmyth_monitor_handler_print,
   4.283 -                                   NULL);
   4.284 -
   4.285 -                    gchar          *back_msg_action = g_new0(gchar, 1);
   4.286 -                    gint            msg_type =
   4.287 -                        gmyth_monitor_handler_is_backend_message(monitor,
   4.288 -                                                                 strlist,
   4.289 -                                                                 &back_msg_action);
   4.290 -
   4.291 -                    if (monitor != NULL
   4.292 -                        && msg_type != GMYTH_BACKEND_NO_MESSAGE)
   4.293 -                        g_signal_emit(monitor, GMYTH_MONITOR_HANDLER_GET_CLASS(monitor)->backend_events_handler_signal_id, 0,   /* details 
   4.294 -                                                                                                                                 */
   4.295 -                                      msg_type, back_msg_action);
   4.296 -
   4.297 -                    if (back_msg_action != NULL)
   4.298 -                        g_free(back_msg_action);
   4.299 -
   4.300 -                }
   4.301 -
   4.302 -            }
   4.303 -
   4.304 -            if (strlist != NULL) {
   4.305 -                g_object_unref(strlist);
   4.306 -                strlist = NULL;
   4.307 -            }
   4.308 -
   4.309 -            io_cond = g_io_channel_get_buffer_condition(io_channel);
   4.310 -
   4.311 -            g_usleep(500);
   4.312 -
   4.313 -        }
   4.314 -        while (recv <= 0 && ((io_cond & G_IO_HUP) == 0));
   4.315 -
   4.316 -        gmyth_debug("\tMONITOR EVENT: Read %d bytes\n", recv);
   4.317 -
   4.318 -    }                           /* main GThread while */
   4.319 -
   4.320 -  clean_up:
   4.321 +clean_up:
   4.322      myth_control_release_context(monitor);
   4.323 -
   4.324 -    g_thread_exit(ret);
   4.325 -
   4.326 -    return (gpointer) ret;
   4.327 -
   4.328 +    return TRUE;
   4.329  }
   4.330  
   4.331 -/** 
   4.332 +/**
   4.333   * Opens connection events' socket the the Monitor socket on 
   4.334   * MythTV backend server.
   4.335   * 
   4.336 @@ -616,7 +505,7 @@
   4.337   * 
   4.338   * @return <code>true</code>, if the socket was successfully opened.
   4.339   */
   4.340 -static          gboolean
   4.341 +static gboolean
   4.342  gmyth_connect_to_backend_monitor(GMythMonitorHandler * monitor)
   4.343  {
   4.344      gboolean        ret = TRUE;
   4.345 @@ -625,7 +514,7 @@
   4.346  
   4.347      /*
   4.348       * Connects the socket, send Mythtv ANN Monitor and verify Mythtv
   4.349 -     * protocol version 
   4.350 +     * protocol version
   4.351       */
   4.352      if (!gmyth_socket_connect_to_backend_events(monitor->event_sock,
   4.353                                                  monitor->hostname,
   4.354 @@ -638,52 +527,38 @@
   4.355      return ret;
   4.356  }
   4.357  
   4.358 -/** 
   4.359 +/**
   4.360   * Opens connection the the Monitor socket on MythTV backend server,
   4.361   * where all status messages are notified to the client.
   4.362 - * 
   4.363 + *
   4.364   * @param monitor The GMythMonitorHandler instance.
   4.365   * @param channel The GIOChannel instance to the Monitor socket.
   4.366 - * 
   4.367 + *
   4.368   * @return Pointer to the boolean value, and it is <code>true</code> only if the 
   4.369 - * 				 GMythMonitorHandler could be configured.
   4.370 + * GMythMonitorHandler could be configured.
   4.371   */
   4.372 -static          gboolean
   4.373 +static gboolean
   4.374  gmyth_monitor_handler_setup(GMythMonitorHandler * monitor,
   4.375                              GIOChannel * channel)
   4.376  {
   4.377 -    gboolean        ret = TRUE;
   4.378 +    gboolean ret = TRUE;
   4.379  
   4.380      if (channel != NULL) {
   4.381          monitor->allow_msgs_listener = TRUE;
   4.382 -
   4.383 -        monitor->th =
   4.384 -            g_thread_create((GThreadFunc) gmyth_monitor_handler_listener,
   4.385 -                            monitor, TRUE, NULL);
   4.386 -        gmyth_debug("MONITOR GThread created!");
   4.387 +        monitor->io_source = g_io_add_watch (channel, G_IO_IN | G_IO_ERR | G_IO_HUP,
   4.388 +                                             gmyth_monitor_handler_listener,
   4.389 +                                             monitor);
   4.390      } else {
   4.391          ret = FALSE;
   4.392 -        goto cleanup;
   4.393      }
   4.394 -
   4.395 -    if (NULL == monitor->th) {
   4.396 -        gmyth_debug
   4.397 -            ("[%s] Error adding GThread listener function to the IO control channel!\n",
   4.398 -             __FUNCTION__);
   4.399 -        ret = FALSE;
   4.400 -        goto cleanup;
   4.401 -    }
   4.402 -
   4.403 -  cleanup:
   4.404 -
   4.405      return ret;
   4.406  }
   4.407  
   4.408 -/** 
   4.409 +/**
   4.410   * Starts the MonitorHandler thread to the GIOWatcher.
   4.411 - * 
   4.412 + *
   4.413   * @param monitor The GMythMonitorHandler instance.
   4.414 - * 
   4.415 + *
   4.416   * @return <code>true</code>, if the MonitorHandler was started.
   4.417   */
   4.418  gboolean
     5.1 --- a/gmyth/src/gmyth_monitor_handler.h	Tue Aug 21 17:14:42 2007 +0100
     5.2 +++ b/gmyth/src/gmyth_monitor_handler.h	Tue Aug 21 20:04:23 2007 +0100
     5.3 @@ -63,12 +63,12 @@
     5.4      GObjectClass    parent_class;
     5.5  
     5.6      /*
     5.7 -     * callbacks 
     5.8 +     * callbacks
     5.9       */
    5.10      guint           backend_events_handler_signal_id;
    5.11  
    5.12      /*
    5.13 -     * signal default handlers 
    5.14 +     * signal default handlers
    5.15       */
    5.16      void            (*backend_events_handler) (GMythMonitorHandler *
    5.17                                                 monitor, gint msg_code,
    5.18 @@ -88,13 +88,7 @@
    5.19       */
    5.20      GMythSocket    *event_sock;
    5.21  
    5.22 -
    5.23 -
    5.24 -
    5.25 -
    5.26 -         
    5.27 -         
    5.28 -                gpointer(*gmyth_monitor_handler_listener) (gpointer data);
    5.29 +    //gpointer(*gmyth_monitor_handler_listener) (gpointer data);
    5.30  
    5.31      gchar          *hostname;
    5.32      gint            port;
    5.33 @@ -109,9 +103,7 @@
    5.34      GHashTable     *backend_msgs;
    5.35  
    5.36      GMutex         *mutex;
    5.37 -
    5.38 -    GThread        *th;
    5.39 -
    5.40 +    guint           io_source;
    5.41  };
    5.42  
    5.43  GType           gmyth_monitor_handler_get_type(void);
     6.1 --- a/gmyth/src/gmyth_socket.c	Tue Aug 21 17:14:42 2007 +0100
     6.2 +++ b/gmyth/src/gmyth_socket.c	Tue Aug 21 20:04:23 2007 +0100
     6.3 @@ -1071,7 +1071,7 @@
     6.4      GIOCondition    io_cond;
     6.5  
     6.6      /*
     6.7 -     * verify if the input (read) buffer is ready to receive data 
     6.8 +     * verify if the input (read) buffer is ready to receive data
     6.9       */
    6.10      g_mutex_lock(gmyth_socket->mutex);
    6.11  
    6.12 @@ -1085,10 +1085,10 @@
    6.13      /*
    6.14       * if ( NULL == gmyth_socket->sd_io_ch->read_buf || ( NULL ==
    6.15       * gmyth_socket->sd_io_ch->read_buf->str ) ) gmyth_socket->sd_io_ch =
    6.16 -     * g_io_channel_unix_new( gmyth_socket->sd ); 
    6.17 +     * g_io_channel_unix_new( gmyth_socket->sd );
    6.18       */
    6.19  
    6.20 -    if (gmyth_socket->sd_io_ch->is_readable /* && !( ( io_cond & G_IO_IN ) 
    6.21 +    if (gmyth_socket->sd_io_ch->is_readable /* && !( ( io_cond & G_IO_IN )
    6.22                                               * == 0 ) */ )
    6.23          io_status =
    6.24              g_io_channel_read_chars(gmyth_socket->sd_io_ch, buffer,