Skip to content
/ go Public
forked from golang/go

Commit f6ca6ed

Browse files
tmm1ianlancetaylor
authored andcommittedApr 21, 2018
net: document caveats for (*syscall.RawConn).Write on Windows
Change-Id: I6e1fa67dc9d4d151c90eb19a6f736e4daa7d4fb3 Reviewed-on: https://go-review.googlesource.com/107615 Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent d487488 commit f6ca6ed

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed
 

‎src/internal/poll/fd_windows.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -946,11 +946,13 @@ func (fd *FD) RawWrite(f func(uintptr) bool) error {
946946
return err
947947
}
948948
defer fd.writeUnlock()
949-
for {
950-
if f(uintptr(fd.Sysfd)) {
951-
return nil
952-
}
949+
950+
if f(uintptr(fd.Sysfd)) {
951+
return nil
953952
}
953+
954+
// TODO(tmm1): find a way to detect socket writability
955+
return syscall.EWINDOWS
954956
}
955957

956958
func sockaddrToRaw(sa syscall.Sockaddr) (unsafe.Pointer, int32, error) {

‎src/net/rawconn.go

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ import (
99
"syscall"
1010
)
1111

12+
// BUG(tmm1): On Windows, the Write method of syscall.RawConn
13+
// does not integrate with the runtime's network poller. It cannot
14+
// wait for the connection to become writeable, and does not respect
15+
// deadlines. If the user-provided callback returns false, the Write
16+
// method will fail immediately.
17+
1218
// BUG(mikio): On NaCl and Plan 9, the Control, Read and Write methods
1319
// of syscall.RawConn are not implemented.
1420

0 commit comments

Comments
 (0)