Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: SagerNet/sing-tun
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: dev
Choose a base ref
...
head repository: itinghub/sing-tun
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: dev
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 1 file changed
  • 2 contributors

Commits on Feb 11, 2026

  1. fix: treat EBADF/ENOTSOCK as closed in darwin BatchRead

    During service reload (e.g. routing mode switch), NativeTun.Close()
    calls stopFd.Stop() then tunFile.Close(). If the batchLoopDarwin
    goroutine is actively processing packets (not blocked in kqueue),
    SYS_RECVMSG_X hits the closed fd and returns EBADF. Since EBADF
    bypasses the stopFd check path in BlockingRecvMMsgUntilStopped
    (returned as n=0, errno=EBADF), BatchRead returns raw EBADF which
    E.IsClosed() does not recognize, causing an infinite error loop
    with ~30k log lines/sec.
    
    Map EBADF and ENOTSOCK to os.ErrClosed in BatchRead so
    batchLoopDarwin exits cleanly.
    
    Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
    dazuiba and claude committed Feb 11, 2026
    Configuration menu
    Copy the full SHA
    19c0e56 View commit details
    Browse the repository at this point in the history
Loading