Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 13, 01:45 UTC
core: Properly preserve unix sockets (fix #5568)
Matthew Holt committed
Jun 21, 2023 at 17:16 UTC
806341e089ed3e5ac825c4844f6fa4d437fdb642
1 file changed
+8
-6
listeners.go
+8
-6
@@ -189,13 +189,15 @@ func (na NetworkAddress) listen(ctx context.Context, portOffset uint, config net
189
// if new listener is a unix socket, make sure we can reuse it later
190
// (we do our own "unlink on close" -- not required, but more tidy)
191
one := int32(1)
192
- switch unix := ln.(type) {
193
- case *net.UnixListener:
194
- unix.SetUnlinkOnClose(false)
195
- ln = &unixListener{unix, lnKey, &one}
196
- unixSockets[lnKey] = ln.(*unixListener)
192
+ switch lnValue := ln.(type) {
193
+ case deleteListener:
194
+ if unix, ok := lnValue.Listener.(*net.UnixListener); ok {
195
+ unix.SetUnlinkOnClose(false)
196
+ ln = &unixListener{unix, lnKey, &one}
197
+ unixSockets[lnKey] = ln.(*unixListener)
198
+ }
199
case *net.UnixConn:
198
- ln = &unixConn{unix, address, lnKey, &one}
200
+ ln = &unixConn{lnValue, address, lnKey, &one}
201
unixSockets[lnKey] = ln.(*unixConn)
202
}
203