Handle G_IO_HUP and G_IO_NVAL when connecting
authorFrank Zschockelt <lm@freakysoft.de>
Sat, 11 May 2019 22:25:15 +0200
changeset 737 ca896de7b10d
parent 736 97f3ff94976f
child 738 264fece7ff0d
Handle G_IO_HUP and G_IO_NVAL when connecting
loudmouth/lm-old-socket.c
loudmouth/lm-proxy.c
--- a/loudmouth/lm-old-socket.c	Sat May 11 22:15:56 2019 +0200
+++ b/loudmouth/lm-old-socket.c	Sat May 11 22:25:15 2019 +0200
@@ -518,7 +518,7 @@
     /* addr = connect_data->current_addr; */
     fd = g_io_channel_unix_get_fd (source);
 
-    if (condition & G_IO_ERR) {
+    if (condition & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
         len = sizeof (err);
         _lm_sock_get_error (fd, &err, &len);
         if (!_lm_sock_is_blocking_error (err)) {
@@ -664,14 +664,14 @@
         socket->watch_connect =
             lm_misc_add_io_watch (socket->context,
                                   connect_data->io_channel,
-                                  G_IO_OUT|G_IO_ERR,
+                                  G_IO_OUT | G_IO_ERR | G_IO_HUP | G_IO_NVAL,
                                   (GIOFunc) _lm_proxy_connect_cb,
                                   connect_data);
     } else {
         socket->watch_connect =
             lm_misc_add_io_watch (socket->context,
                                   connect_data->io_channel,
-                                  G_IO_OUT|G_IO_ERR,
+                                  G_IO_OUT | G_IO_ERR | G_IO_HUP | G_IO_NVAL,
                                   (GIOFunc) socket_connect_cb,
                                   connect_data);
     }
--- a/loudmouth/lm-proxy.c	Sat May 11 22:15:56 2019 +0200
+++ b/loudmouth/lm-proxy.c	Sat May 11 22:25:15 2019 +0200
@@ -218,7 +218,7 @@
 
     g_return_val_if_fail (proxy != NULL, FALSE);
 
-    if (condition & G_IO_ERR) {
+    if (condition & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
         len = sizeof (error);
         _lm_sock_get_error (connect_data->fd, &error, &len);
         _lm_old_socket_failed_with_error (connect_data, error);