fix(transport): correctly release UDS locker file (#2305)

* fix(transport): correctly release UDS locker file

* use callback function to do some jobs after create listener
This commit is contained in:
A1lo 2023-08-26 16:23:54 +08:00 committed by yuhan6665
parent 2d5475f428
commit 10d6b06578
5 changed files with 49 additions and 49 deletions

View file

@ -27,7 +27,6 @@ type Listener struct {
handler internet.ConnHandler
local net.Addr
config *Config
locker *internet.FileLocker // for unix domain socket
}
func (l *Listener) Addr() net.Addr {
@ -35,9 +34,6 @@ func (l *Listener) Addr() net.Addr {
}
func (l *Listener) Close() error {
if l.locker != nil {
l.locker.Release()
}
return l.server.Close()
}
@ -180,10 +176,6 @@ func Listen(ctx context.Context, address net.Address, port net.Port, streamSetti
newError("failed to listen on ", address).Base(err).AtError().WriteToLog(session.ExportIDToError(ctx))
return
}
locker := ctx.Value(address.Domain())
if locker != nil {
listener.locker = locker.(*internet.FileLocker)
}
} else { // tcp
streamListener, err = internet.ListenSystem(ctx, &net.TCPAddr{
IP: address.IP(),