mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-24 22:03:33 +08:00
Appease linter
This commit is contained in:
parent
9563666bfb
commit
2b2addebb8
|
@ -138,6 +138,26 @@ func reusePort(network, address string, conn syscall.RawConn) error {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type unixListener struct {
|
||||||
|
*net.UnixListener
|
||||||
|
mapKey string
|
||||||
|
count *int32 // accessed atomically
|
||||||
|
}
|
||||||
|
|
||||||
|
func (uln *unixListener) Close() error {
|
||||||
|
newCount := atomic.AddInt32(uln.count, -1)
|
||||||
|
if newCount == 0 {
|
||||||
|
defer func() {
|
||||||
|
addr := uln.Addr().String()
|
||||||
|
unixSocketsMu.Lock()
|
||||||
|
delete(unixSockets, uln.mapKey)
|
||||||
|
unixSocketsMu.Unlock()
|
||||||
|
_ = syscall.Unlink(addr)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
return uln.UnixListener.Close()
|
||||||
|
}
|
||||||
|
|
||||||
// deleteListener is a type that simply deletes itself
|
// deleteListener is a type that simply deletes itself
|
||||||
// from the listenerPool when it closes. It is used
|
// from the listenerPool when it closes. It is used
|
||||||
// solely for the purpose of reference counting (i.e.
|
// solely for the purpose of reference counting (i.e.
|
||||||
|
|
20
listeners.go
20
listeners.go
|
@ -694,26 +694,6 @@ func RegisterNetwork(network string, getListener ListenerFunc) {
|
||||||
networkTypes[network] = getListener
|
networkTypes[network] = getListener
|
||||||
}
|
}
|
||||||
|
|
||||||
type unixListener struct {
|
|
||||||
*net.UnixListener
|
|
||||||
mapKey string
|
|
||||||
count *int32 // accessed atomically
|
|
||||||
}
|
|
||||||
|
|
||||||
func (uln *unixListener) Close() error {
|
|
||||||
newCount := atomic.AddInt32(uln.count, -1)
|
|
||||||
if newCount == 0 {
|
|
||||||
defer func() {
|
|
||||||
addr := uln.Addr().String()
|
|
||||||
unixSocketsMu.Lock()
|
|
||||||
delete(unixSockets, uln.mapKey)
|
|
||||||
unixSocketsMu.Unlock()
|
|
||||||
_ = syscall.Unlink(addr)
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
return uln.UnixListener.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
type unixConn struct {
|
type unixConn struct {
|
||||||
*net.UnixConn
|
*net.UnixConn
|
||||||
filename string
|
filename string
|
||||||
|
|
Loading…
Reference in New Issue
Block a user