]> Cypherpunks repositories - gostls13.git/commitdiff
net: document caveats for (*syscall.RawConn).Write on Windows
authorAman Gupta <aman@tmm1.net>
Tue, 17 Apr 2018 21:28:00 +0000 (14:28 -0700)
committerIan Lance Taylor <iant@golang.org>
Sat, 21 Apr 2018 00:48:00 +0000 (00:48 +0000)
Change-Id: I6e1fa67dc9d4d151c90eb19a6f736e4daa7d4fb3
Reviewed-on: https://go-review.googlesource.com/107615
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/internal/poll/fd_windows.go
src/net/rawconn.go

index cd9f88b5f7ed65e680e1ed91021b50354faf59d9..75bd1669fb299d80b0615d6db390b27f3bae76d8 100644 (file)
@@ -946,11 +946,13 @@ func (fd *FD) RawWrite(f func(uintptr) bool) error {
                return err
        }
        defer fd.writeUnlock()
-       for {
-               if f(uintptr(fd.Sysfd)) {
-                       return nil
-               }
+
+       if f(uintptr(fd.Sysfd)) {
+               return nil
        }
+
+       // TODO(tmm1): find a way to detect socket writability
+       return syscall.EWINDOWS
 }
 
 func sockaddrToRaw(sa syscall.Sockaddr) (unsafe.Pointer, int32, error) {
index 11f01ffda8a0d69905c3154b413730eb920980e2..e6528167396742f190b3ac70b4857b397235a6d7 100644 (file)
@@ -9,6 +9,12 @@ import (
        "syscall"
 )
 
+// BUG(tmm1): On Windows, the Write method of syscall.RawConn
+// does not integrate with the runtime's network poller. It cannot
+// wait for the connection to become writeable, and does not respect
+// deadlines. If the user-provided callback returns false, the Write
+// method will fail immediately.
+
 // BUG(mikio): On NaCl and Plan 9, the Control, Read and Write methods
 // of syscall.RawConn are not implemented.