Retry system listen

This commit is contained in:
世界 2024-10-14 22:10:16 +08:00
parent c3a3f8141f
commit 07278fb470
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
3 changed files with 32 additions and 2 deletions

View file

@ -1,10 +1,13 @@
package tun
import (
"errors"
"os"
"path/filepath"
"github.com/sagernet/sing-tun/internal/winfw"
"golang.org/x/sys/windows"
)
func fixWindowsFirewall() error {
@ -23,3 +26,7 @@ func fixWindowsFirewall() error {
_, err = winfw.FirewallRuleAddAdvanced(rule)
return err
}
func retryableListenError(err error) bool {
return errors.Is(err, windows.WSAEADDRNOTAVAIL)
}