Skip to content

Commit 2b2adde

Browse files
committed
Appease linter
1 parent 9563666 commit 2b2adde

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

listen_unix.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,26 @@ func reusePort(network, address string, conn syscall.RawConn) error {
138138
})
139139
}
140140

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+
141161
// deleteListener is a type that simply deletes itself
142162
// from the listenerPool when it closes. It is used
143163
// solely for the purpose of reference counting (i.e.

listeners.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -694,26 +694,6 @@ func RegisterNetwork(network string, getListener ListenerFunc) {
694694
networkTypes[network] = getListener
695695
}
696696

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-
717697
type unixConn struct {
718698
*net.UnixConn
719699
filename string

0 commit comments

Comments
 (0)