You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/04/08 14:48:32 UTC

[tomcat] 01/02: BZ 64311 - Prevent test from hanging if client fails to connect

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 01d748c1d51c5e568cdb3cc6540527708e7c3e59
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Apr 8 15:46:01 2020 +0100

    BZ 64311 - Prevent test from hanging if client fails to connect
---
 test/org/apache/tomcat/jni/TestSocketServerAnyLocalAddress.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/org/apache/tomcat/jni/TestSocketServerAnyLocalAddress.java b/test/org/apache/tomcat/jni/TestSocketServerAnyLocalAddress.java
index 866ba77..b13b116 100644
--- a/test/org/apache/tomcat/jni/TestSocketServerAnyLocalAddress.java
+++ b/test/org/apache/tomcat/jni/TestSocketServerAnyLocalAddress.java
@@ -146,6 +146,9 @@ public class TestSocketServerAnyLocalAddress extends AbstractJniTest {
                 sock.close();
             } catch (Exception e) {
                 e.printStackTrace();
+                // Prevent the test from hanging on Socket.accept(serverSocket)
+                // if the client fails
+                Socket.shutdown(serverSocket, Socket.APR_SHUTDOWN_READWRITE);
             }
         }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org