]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #2150: Connection hangs on automatic retry
authorhno <>
Mon, 7 Jan 2008 23:22:06 +0000 (23:22 +0000)
committerhno <>
Mon, 7 Jan 2008 23:22:06 +0000 (23:22 +0000)
With epoll and probably kqueue as well the filedescriptor need to be
reregistered with the kernle after being replaced with dup2().

src/comm.cc
src/comm.h
src/comm_epoll.cc
src/comm_kqueue.cc
src/comm_poll.cc
src/comm_select.cc
src/comm_select_win32.cc

index c2915271fdf2e5db392132bc9147669eacec1eb6..85c64d9675ca628e3833dc7db79aca9c98e0cbac 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.439 2007/12/14 23:11:46 amosjeffries Exp $
+ * $Id: comm.cc,v 1.440 2008/01/07 16:22:06 hno Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -1161,6 +1161,7 @@ ConnectStateData::commResetFD()
 
         return 0;
     }
+    commResetSelect(fd);
 
     close(fd2);
     fde *F = &fd_table[fd];
index 89ca9f09c7d52b779b1182ebc9c2dbf6d1ab8660..e292eeac21d0f51374117062aebd2ca687d23c06 100644 (file)
@@ -58,6 +58,7 @@ SQUIDCEXTERN u_short comm_local_port(int fd);
 SQUIDCEXTERN int comm_set_tos(int fd, int tos);
 
 SQUIDCEXTERN void commSetSelect(int, unsigned int, PF *, void *, time_t);
+SQUIDCEXTERN void commResetSelect(int);
 
 SQUIDCEXTERN int comm_udp_sendto(int sock, const IPAddress &to, const void *buf, int buflen);
 extern void comm_write(int fd, const char *buf, int len, IOCB *callback, void *callback_data, FREE *func);
index 51ac3be614c62e7058b90b0ced8067773ef751f8..758fd8817ce7e946c6ada68a3abfb3b62038a9d2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm_epoll.cc,v 1.17 2007/07/19 13:33:18 hno Exp $
+ * $Id: comm_epoll.cc,v 1.18 2008/01/07 16:22:06 hno Exp $
  *
  * DEBUG: section 5     Socket Functions
  *
@@ -203,6 +203,14 @@ commSetSelect(int fd, unsigned int type, PF * handler,
         F->timeout = squid_curtime + timeout;
 }
 
+void
+commResetSelect(int fd)
+{
+    fde *F = &fd_table[fd];
+    F->epoll_state = 0;
+    commSetSelect(fd, 0, NULL, NULL, 0);
+}
+
 
 static void commIncomingStats(StoreEntry * sentry);
 
index d759e28fb5650a0dfeeffa70950f3e555918b697..bd60c5fbcff6a1cd302608c0fbf17b943c26aa55 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm_kqueue.cc,v 1.17 2007/07/19 13:33:18 hno Exp $
+ * $Id: comm_kqueue.cc,v 1.18 2008/01/07 16:22:06 hno Exp $
  *
  * DEBUG: section 5     Socket Functions
  *
@@ -210,6 +210,18 @@ commSetSelect(int fd, unsigned int type, PF * handler,
 
 }
 
+void
+commResetSelect(int fd)
+{
+    fde *F = &fd_table[fd];
+    if (F->read_handler) {
+       kq_update_events(fd, EVFILT_READ, (PF *)1);
+    }
+    if (F->write_handler) {
+       kq_update_events(fd, EVFILT_WRITE, (PF *)1);
+    }
+}
+
 /*
  * Check all connections for new connections and input data that is to be
  * processed. Also check for connections with data queued and whether we can
index b6d93540275a7426a8a9cfa64cb3942361c8f972..3c9886e99bd1e732bdc7f1ea60065823f23aaad0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm_poll.cc,v 1.24 2007/09/01 13:09:59 hno Exp $
+ * $Id: comm_poll.cc,v 1.25 2008/01/07 16:22:06 hno Exp $
  *
  * DEBUG: section 5     Socket Functions
  *
@@ -145,6 +145,11 @@ commSetSelect(int fd, unsigned int type, PF * handler, void *client_data,
         F->timeout = squid_curtime + timeout;
 }
 
+void
+commResetSelect(int fd)
+{
+}
+
 static int
 fdIsIcp(int fd)
 {
index ec4ddf842d897c5f05efb4d53f7748344ed9b3e9..493a1528f8aabf24e557e11261cb0fcb4cc453d5 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm_select.cc,v 1.82 2007/12/14 23:11:46 amosjeffries Exp $
+ * $Id: comm_select.cc,v 1.83 2008/01/07 16:22:06 hno Exp $
  *
  * DEBUG: section 5     Socket Functions
  *
@@ -156,6 +156,10 @@ commSetSelect(int fd, unsigned int type, PF * handler, void *client_data,
         F->timeout = squid_curtime + timeout;
 }
 
+void
+commResetSelect(int fd)
+{
+}
 
 static int
 fdIsIcp(int fd)
index e925b874fca81b39f0283ca3959fa1a9be5d6f1b..4a112ab25bfa90a562eda9fb71c203d69898bfeb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm_select_win32.cc,v 1.4 2007/04/30 16:56:09 wessels Exp $
+ * $Id: comm_select_win32.cc,v 1.5 2008/01/07 16:22:06 hno Exp $
  *
  * DEBUG: section 5     Socket Functions
  *
@@ -156,6 +156,11 @@ commSetSelect(int fd, unsigned int type, PF * handler, void *client_data,
         F->timeout = squid_curtime + timeout;
 }
 
+void
+commResetSelect(int fd)
+{
+}
+
 
 static int
 fdIsIcp(int fd)