mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-27 06:03:48 +03:00
core: Properly preserve unix sockets (fix #5568)
This commit is contained in:
parent
0468508e92
commit
806341e089
1 changed files with 8 additions and 6 deletions
|
@ -189,13 +189,15 @@ func (na NetworkAddress) listen(ctx context.Context, portOffset uint, config net
|
||||||
// if new listener is a unix socket, make sure we can reuse it later
|
// if new listener is a unix socket, make sure we can reuse it later
|
||||||
// (we do our own "unlink on close" -- not required, but more tidy)
|
// (we do our own "unlink on close" -- not required, but more tidy)
|
||||||
one := int32(1)
|
one := int32(1)
|
||||||
switch unix := ln.(type) {
|
switch lnValue := ln.(type) {
|
||||||
case *net.UnixListener:
|
case deleteListener:
|
||||||
|
if unix, ok := lnValue.Listener.(*net.UnixListener); ok {
|
||||||
unix.SetUnlinkOnClose(false)
|
unix.SetUnlinkOnClose(false)
|
||||||
ln = &unixListener{unix, lnKey, &one}
|
ln = &unixListener{unix, lnKey, &one}
|
||||||
unixSockets[lnKey] = ln.(*unixListener)
|
unixSockets[lnKey] = ln.(*unixListener)
|
||||||
|
}
|
||||||
case *net.UnixConn:
|
case *net.UnixConn:
|
||||||
ln = &unixConn{unix, address, lnKey, &one}
|
ln = &unixConn{lnValue, address, lnKey, &one}
|
||||||
unixSockets[lnKey] = ln.(*unixConn)
|
unixSockets[lnKey] = ln.(*unixConn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue