mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-04 00:40:27 +00:00
Removed setting the newly created socket pair to non-blocking mode
This commit is contained in:
parent
507b85de51
commit
fec72d2b6c
1 changed files with 0 additions and 37 deletions
|
@ -39,7 +39,6 @@ textwindows int sys_socketpair_nt_stream(int family, int type, int proto, int sv
|
||||||
struct sockaddr_in *sa = (struct sockaddr_in *)&ss;
|
struct sockaddr_in *sa = (struct sockaddr_in *)&ss;
|
||||||
uint32_t ss_len;
|
uint32_t ss_len;
|
||||||
int spR = -1, spW = -1;
|
int spR = -1, spW = -1;
|
||||||
int opt;
|
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
int listensock = -1;
|
int listensock = -1;
|
||||||
|
|
||||||
|
@ -85,15 +84,6 @@ textwindows int sys_socketpair_nt_stream(int family, int type, int proto, int sv
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set non-blocking */
|
|
||||||
opt = fcntl(spR, F_GETFL, 0);
|
|
||||||
if (opt == -1) {
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
if(fcntl(spR, F_SETFL, opt | O_NONBLOCK) == -1) {
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (connect(spR, (struct sockaddr *)&ss, ss_len) < 0) {
|
if (connect(spR, (struct sockaddr *)&ss, ss_len) < 0) {
|
||||||
errno = WSAGetLastError();
|
errno = WSAGetLastError();
|
||||||
if (errno != EINPROGRESS && errno != EWOULDBLOCK) {
|
if (errno != EINPROGRESS && errno != EWOULDBLOCK) {
|
||||||
|
@ -108,14 +98,6 @@ textwindows int sys_socketpair_nt_stream(int family, int type, int proto, int sv
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Set non-blocking */
|
|
||||||
opt = fcntl(spW, F_GETFL, 0);
|
|
||||||
if (opt == -1) {
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
if(fcntl(spW, F_SETFL, opt | O_NONBLOCK) == -1) {
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = 0; /* Success */
|
rc = 0; /* Success */
|
||||||
|
|
||||||
|
@ -143,7 +125,6 @@ done:
|
||||||
int sys_socketpair_nt_dgram(int family, int type, int proto, int sv[2]) {
|
int sys_socketpair_nt_dgram(int family, int type, int proto, int sv[2]) {
|
||||||
struct sockaddr_in sa;
|
struct sockaddr_in sa;
|
||||||
uint32_t sa_len;
|
uint32_t sa_len;
|
||||||
int opt;
|
|
||||||
int spR = -1, spW = -1;
|
int spR = -1, spW = -1;
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
|
|
||||||
|
@ -210,24 +191,6 @@ int sys_socketpair_nt_dgram(int family, int type, int proto, int sv[2]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now we finally got both bi-directional sockets: RD <---> WR */
|
/* Now we finally got both bi-directional sockets: RD <---> WR */
|
||||||
|
|
||||||
/* Finally set both sockets as non-blocking */
|
|
||||||
opt = fcntl(spW, F_GETFL, 0);
|
|
||||||
if (opt == -1) {
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
if(fcntl(spW, F_SETFL, opt | O_NONBLOCK) == -1) {
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
opt = fcntl(spR, F_GETFL, 0);
|
|
||||||
if (opt == -1) {
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
if(fcntl(spR, F_SETFL, opt | O_NONBLOCK) == -1) {
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue