d4d9f0afaa
Prior to this change, connection errors such as "Connection refused" etc, are caught either by some error condition being detected by the eventhandler thread and that error condition being propagated to the Dart thread, or by the first read or write after a "successful" connection failing with an error. However, posix documentation for non-blocking sockets recommends either checking getsockopt(SO_ERROR), or calling connect() a second time following the first write event on a socket after the first connect call returns EINPROGRESS. On Fuchsia, this check is mandatory because errors like "Connection refused" are neither signaled on the socket's underlying OS handle, nor indicated by error returns from read() and write(). This change adds the check, which is optional on other platforms, but mandatory on Fuchsia, to the Dart socket connection loop after the first write signal is asserted. Change-Id: I8aeea4665913f79e8138bdd830676ae43066a959 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104263 Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Zach Anderson <zra@google.com>