• Ian Lance Taylor's avatar
    net: handle spurious netpoll wakeups in connect · bf0f6922
    Ian Lance Taylor authored
    In some cases the netpoll code can cause a spurious wakeup. This is
    normally harmless, as the woken up code simply retries the operation.
    However, for connect, the test we were using to see whether the
    connect had succeeded (setsockopt(SO_ERROR)) was not reliable in the
    case of a spurious wakeup.  Change to using a reliable test (getpeername).
    On Darwin we used a different technique: a second call to connect;
    change Darwin to use getpeername as well.
    
    Return the result of getpeername to avoid having to call it twice.
    
    Fixes #19289.
    
    Change-Id: I119ec8e7a41f482f1e590d4c65a37f6103fa22d9
    Reviewed-on: https://go-review.googlesource.com/45815
    Run-TryBot: Ian Lance Taylor <iant@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    bf0f6922
fd_windows.go 5.98 KB