Skip to content

Commit 862fb86

Browse files
committed
internal/poll: only call SetFileCompletionNotificationModes for sockets
CL 36799 made SetFileCompletionNotificationModes to be called for file handles. I don't think it is correct. Revert that change. Fixes #22024 Fixes #22207 Change-Id: I26260e8a727131cffbf60958d79eca2457495554 Reviewed-on: https://go-review.googlesource.com/69871 Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent c37647f commit 862fb86

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/internal/poll/fd_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,12 +357,12 @@ func (fd *FD) Init(net string, pollable bool) (string, error) {
357357
if err != nil {
358358
return "", err
359359
}
360-
if useSetFileCompletionNotificationModes {
360+
if pollable && useSetFileCompletionNotificationModes {
361361
// We do not use events, so we can skip them always.
362362
flags := uint8(syscall.FILE_SKIP_SET_EVENT_ON_HANDLE)
363363
// It's not safe to skip completion notifications for UDP:
364364
// http://blogs.technet.com/b/winserverperformance/archive/2008/06/26/designing-applications-for-high-performance-part-iii.aspx
365-
if net == "tcp" || net == "file" {
365+
if net == "tcp" {
366366
flags |= syscall.FILE_SKIP_COMPLETION_PORT_ON_SUCCESS
367367
}
368368
err := syscall.SetFileCompletionNotificationModes(fd.Sysfd, flags)

0 commit comments

Comments
 (0)