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

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new d0e4445  Delete UDS file on close
d0e4445 is described below

commit d0e4445b0546e70f78f615d566897d74abdaf212
Author: remm <r...@apache.org>
AuthorDate: Thu Jan 7 15:13:55 2021 +0100

    Delete UDS file on close
    
    Only if it was actually bound successfully. Thanks to jfclere for the
    ideas.
---
 java/org/apache/tomcat/util/net/AbstractEndpoint.java | 2 +-
 java/org/apache/tomcat/util/net/NioEndpoint.java      | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java 
b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index 471190d..3cc0a64 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -617,7 +617,7 @@ public abstract class AbstractEndpoint<S,U> {
     private boolean bindOnInit = true;
     public boolean getBindOnInit() { return bindOnInit; }
     public void setBindOnInit(boolean b) { this.bindOnInit = b; }
-    private volatile BindState bindState = BindState.UNBOUND;
+    protected volatile BindState bindState = BindState.UNBOUND;
 
     /**
      * Keepalive timeout, if not set the soTimeout is used.
diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java 
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 0573938..21f5507 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -405,6 +405,9 @@ public class NioEndpoint extends 
AbstractJsseEndpoint<NioChannel,SocketChannel>
             serverSock.close();
         }
         serverSock = null;
+        if (getUnixDomainSocketPath() != null && bindState != 
BindState.UNBOUND) {
+            Files.delete(Paths.get(getUnixDomainSocketPath()));
+        }
     }
 
     // ------------------------------------------------------ Protected Methods


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

Reply via email to