mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Rewrite Windows connect()
Our old code wasn't working with projects like Qt that call connect() in O_NONBLOCK mode multiple times. This change overhauls connect() to use a simpler WSAConnect() API and follows the same pattern as cosmo accept(). This change also reduces the binary footprint of read(), which no longer needs to depend on our enormous clock_gettime() function.
This commit is contained in:
parent
5469202ea8
commit
e142124730
25 changed files with 556 additions and 277 deletions
|
@ -121,12 +121,6 @@ TEST(connect, nonblocking) {
|
|||
ASSERT_SYS(0, 3, socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, IPPROTO_TCP));
|
||||
ASSERT_SYS(EINPROGRESS, -1,
|
||||
connect(3, (struct sockaddr *)&addr, sizeof(addr)));
|
||||
if (!IsLinux() && !IsNetbsd() && !IsXnu()) {
|
||||
// this doens't work on linux and netbsd
|
||||
// on MacOS this can EISCONN before accept() is called
|
||||
ASSERT_SYS(EALREADY, -1,
|
||||
connect(3, (struct sockaddr *)&addr, sizeof(addr)));
|
||||
}
|
||||
ASSERT_SYS(EAGAIN, -1, read(3, buf, 16));
|
||||
*sem = 1;
|
||||
{ // wait until connected
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue