• Wèi Cōngruì's avatar
    internal/poll: make FD.isFile mean whether it isn't socket on Windows · a60b56ad
    Wèi Cōngruì authored
    Before this change, if a directory was closed twice on Windows,
    the returning error would be "use of closed network connection".
    
    Some code assumes FD.isFile means whether the fd isn't a network
    socket, which is true on Unix. But isFile reports whether
    the fd is a normal file rather than directory or console on Windows.
    
    With this change, isFile will have the same meaning on different
    platforms. And the change adds a new field kind to replace isConsole
    and isDir.
    
    Change-Id: Ib12265f1e12fa3d0239ae925291128a84be59cc2
    GitHub-Last-Rev: 3f031756de6ce0b96c1f102ad280950f4adbf6c2
    GitHub-Pull-Request: golang/go#30589
    Reviewed-on: https://go-review.googlesource.com/c/go/+/165257
    Run-TryBot: Ian Lance Taylor <iant@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
    a60b56ad
fd_windows.go 28.1 KB