Remove command server listen retry

This commit is contained in:
世界
2026-10-23 19:57:06 +08:00
parent 1cc885e040
commit ae4826a387
+4 -16
View File
@@ -2,13 +2,10 @@ package libbox
import (
"context"
"errors"
"net"
"os"
"path/filepath"
"strconv"
"syscall"
"time"
"github.com/sagernet/sing-box/adapter"
C "github.com/sagernet/sing-box/constant"
@@ -144,19 +141,10 @@ func (s *CommandServer) Start() error {
if sCommandServerListenPort == 0 {
sockPath := filepath.Join(sBasePath, "command.sock")
os.Remove(sockPath)
for range 30 {
listener, err = net.ListenUnix("unix", &net.UnixAddr{
Name: sockPath,
Net: "unix",
})
if err == nil {
break
}
if !errors.Is(err, syscall.EROFS) {
break
}
time.Sleep(time.Second)
}
listener, err = net.ListenUnix("unix", &net.UnixAddr{
Name: sockPath,
Net: "unix",
})
if err != nil {
return E.Cause(err, "listen command server")
}