You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2021/01/07 14:14:23 UTC

[tomcat] branch master updated: Delete UDS file on close

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0ee3382  Delete UDS file on close
0ee3382 is described below

commit 0ee33826560943b1c4852326746f79ba90b75c4e
Author: remm <re...@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 fe9957b..55356f9 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -586,7 +586,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 a1743a4..2661671 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -349,6 +349,9 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
             serverSock.close();
         }
         serverSock = null;
+        if (getUnixDomainSocketPath() != null && bindState != BindState.UNBOUND) {
+            Files.delete(Paths.get(getUnixDomainSocketPath()));
+        }
     }
 
 


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