Author: rjung
Date: Tue Jan  6 15:35:49 2015
New Revision: 1649835

URL: http://svn.apache.org/r1649835
Log:
Adjust linger parameters used during connection
shutdown.

Modified:
    tomcat/jk/trunk/native/common/jk_connect.c
    tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml

Modified: tomcat/jk/trunk/native/common/jk_connect.c
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_connect.c?rev=1649835&r1=1649834&r2=1649835&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_connect.c (original)
+++ tomcat/jk/trunk/native/common/jk_connect.c Tue Jan  6 15:35:49 2015
@@ -831,8 +831,18 @@ int jk_close_socket(jk_sock_t sd, jk_log
 #ifndef MAX_SECS_TO_LINGER
 #define MAX_SECS_TO_LINGER 2
 #endif
-#define MS_TO_LINGER  500
-#define MS_TO_LINGER_LAST 2
+
+#ifndef MS_TO_LINGER
+#define MS_TO_LINGER  100
+#endif
+
+#ifndef MS_TO_LINGER_LAST
+#define MS_TO_LINGER_LAST 20
+#endif
+
+#ifndef MAX_READ_RETRY
+#define MAX_READ_RETRY 10
+#endif
 
 #ifndef MAX_LINGER_BYTES
 #define MAX_LINGER_BYTES 32768
@@ -908,7 +918,9 @@ int jk_shutdown_socket(jk_sock_t sd, jk_
             /* Do a restartable read on the socket
              * draining out all the data currently in the socket buffer.
              */
+            int num = 0;
             do {
+                num++;
 #if defined(WIN32) || (defined(NETWARE) && defined(__NOVELL_LIBC__))
                 rc = recv(sd, &dummy[0], sizeof(dummy), 0);
                 if (JK_IS_SOCKET_ERROR(rc))
@@ -918,7 +930,7 @@ int jk_shutdown_socket(jk_sock_t sd, jk_
 #endif
                 if (rc > 0)
                     rp += rc;
-            } while (JK_IS_SOCKET_ERROR(rc) && (errno == EINTR || errno == 
EAGAIN));
+            } while (JK_IS_SOCKET_ERROR(rc) && (errno == EINTR || errno == 
EAGAIN) && num < MAX_READ_RETRY);
 
             if (rc < 0) {
                 /* Read failed.

Modified: tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml?rev=1649835&r1=1649834&r2=1649835&view=diff
==============================================================================
--- tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml Tue Jan  6 15:35:49 2015
@@ -189,6 +189,9 @@
         checking of idle connections using CPing. Updating the time stamp
         breaks closing idle connections. (rjung)
       </fix>
+      <fix>
+        Adjust linger parameters used during connection shutdown. (rjung)
+      </fix>
     </changelog>
   </subsection>
 </section>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to