@marcel91200 / caddy Mirror · read-only / commits / 2b2addeb
Fork 0

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

Appease linter

Matthew Holt committed Jun 21, 2023 at 17:59 UTC 2b2addebb8cc5dfc7d4d1d34c82f3c46159fea12
2 files changed +20 -20
listen_unix.go
+20
@@ -138,6 +138,26 @@ func reusePort(network, address string, conn syscall.RawConn) error {
138 })
139 }
140
141 +type unixListener struct {
142 + *net.UnixListener
143 + mapKey string
144 + count *int32 // accessed atomically
145 +}
146 +
147 +func (uln *unixListener) Close() error {
148 + newCount := atomic.AddInt32(uln.count, -1)
149 + if newCount == 0 {
150 + defer func() {
151 + addr := uln.Addr().String()
152 + unixSocketsMu.Lock()
153 + delete(unixSockets, uln.mapKey)
154 + unixSocketsMu.Unlock()
155 + _ = syscall.Unlink(addr)
156 + }()
157 + }
158 + return uln.UnixListener.Close()
159 +}
160 +
161 // deleteListener is a type that simply deletes itself
162 // from the listenerPool when it closes. It is used
163 // solely for the purpose of reference counting (i.e.
listeners.go
-20
@@ -694,26 +694,6 @@ func RegisterNetwork(network string, getListener ListenerFunc) {
694 networkTypes[network] = getListener
695 }
696
697 -type unixListener struct {
698 - *net.UnixListener
699 - mapKey string
700 - count *int32 // accessed atomically
701 -}
702 -
703 -func (uln *unixListener) Close() error {
704 - newCount := atomic.AddInt32(uln.count, -1)
705 - if newCount == 0 {
706 - defer func() {
707 - addr := uln.Addr().String()
708 - unixSocketsMu.Lock()
709 - delete(unixSockets, uln.mapKey)
710 - unixSocketsMu.Unlock()
711 - _ = syscall.Unlink(addr)
712 - }()
713 - }
714 - return uln.UnixListener.Close()
715 -}
716 -
697 type unixConn struct {
698 *net.UnixConn
699 filename string