Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(342)

Unified Diff: src/pkg/net/fd_unix.go

Issue 69340044: code review 69340044: net: fix non-blocking connect handling on dragonfly (Closed)
Patch Set: diff -r 4cd83f2e218e https://go.googlecode.com/hg/ Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/net/fd_unix.go
===================================================================
--- a/src/pkg/net/fd_unix.go
+++ b/src/pkg/net/fd_unix.go
@@ -96,6 +96,28 @@
if err = fd.pd.WaitWrite(); err != nil {
return err
}
+
+ // Performing multiple connect system calls on a non-blocking
+ // socket under DragonFly BSD does not necessarily result in
+ // earlier errors being returned, particularly if we are
+ // connecting to localhost. Instead, once netpoll tells us that
+ // the socket is ready, get the SO_ERROR socket option to see
+ // if the connection succeeded or failed. See issue 7474 for
+ // further details. At some point we may want to consider
+ // doing the same on other Unixes.
+ if runtime.GOOS == "dragonfly" {
+ nerr, err := syscall.GetsockoptInt(fd.sysfd, syscall.SOL_SOCKET, syscall.SO_ERROR)
+ if err != nil {
+ return err
+ }
+ if nerr == 0 {
+ return nil
+ }
+ err = syscall.Errno(nerr)
+ if err != syscall.EINPROGRESS && err != syscall.EALREADY && err != syscall.EINTR {
+ return err
+ }
+ }
}
return nil
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b