On Tue, Sep 27, 2016 at 10:44:31AM +0100, Justin Cattle wrote:
> >
> > I'm facing the same problem here:
> >
>
> Me too!

Hi

Here is a quick and dirty workaround.

-- 
Elen sila lumenn' omentielvo

Ondrej 'Santiago' Zajicek (email: santi...@crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index 120eb90..486319f 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -1854,20 +1854,6 @@ sk_write(sock *s)
 }
 
 void
-sk_err(sock *s, int revents)
-{
-  int se = 0, sse = sizeof(se);
-  if (revents & POLLERR)
-    if (getsockopt(s->fd, SOL_SOCKET, SO_ERROR, &se, &sse) < 0)
-    {
-      log(L_ERR "IO: Socket error: SO_ERROR: %m");
-      se = 0;
-    }
-
-  s->err_hook(s, se);
-}
-
-void
 sk_dump_all(void)
 {
   node *n;
@@ -2177,7 +2163,7 @@ io_loop(void)
 	      int steps;
 
 	      steps = MAX_STEPS;
-	      if (s->fast_rx && (pfd[s->index].revents & POLLIN) && s->rx_hook)
+	      if (s->fast_rx && (pfd[s->index].revents & (POLLIN | POLLHUP | POLLERR)) && s->rx_hook)
 		do
 		  {
 		    steps--;
@@ -2199,7 +2185,6 @@ io_loop(void)
 		      goto next;
 		  }
 		while (e && steps);
-
 	      current_sock = sk_next(s);
 	    next: ;
 	    }
@@ -2223,26 +2208,18 @@ io_loop(void)
 		  goto next2;
 		}
 
-	      if (!s->fast_rx && (pfd[s->index].revents & POLLIN) && s->rx_hook)
+	      if (!s->fast_rx && (pfd[s->index].revents & (POLLIN | POLLHUP | POLLERR)) && s->rx_hook)
 		{
 		  count++;
 		  io_log_event(s->rx_hook, s->data);
 		  sk_read(s, pfd[s->index].revents);
 		  if (s != current_sock)
-		    goto next2;
+		      goto next2;
 		}
-
-	      if (pfd[s->index].revents & (POLLHUP | POLLERR))
-		{
-		  sk_err(s, pfd[s->index].revents);
-		  goto next2;
-		}
-
 	      current_sock = sk_next(s);
 	    next2: ;
 	    }
 
-
 	  stored_sock = current_sock;
 	}
     }

Attachment: signature.asc
Description: Digital signature

Reply via email to