mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 15:48:49 -05:00
connect: implement TCP Fast Open for OS X
This commit is contained in:
parent
dc68f2dab9
commit
8f72b13660
@ -1097,7 +1097,24 @@ static CURLcode singleipconnect(struct connectdata *conn,
|
||||
|
||||
/* Connect TCP sockets, bind UDP */
|
||||
if(!isconnected && (conn->socktype == SOCK_STREAM)) {
|
||||
rc = connect(sockfd, &addr.sa_addr, addr.addrlen);
|
||||
if(conn->bits.tcp_fastopen) {
|
||||
#if defined(CONNECT_DATA_IDEMPOTENT) /* OS X */
|
||||
sa_endpoints_t endpoints;
|
||||
endpoints.sae_srcif = 0;
|
||||
endpoints.sae_srcaddr = NULL;
|
||||
endpoints.sae_srcaddrlen = 0;
|
||||
endpoints.sae_dstaddr = &addr.sa_addr;
|
||||
endpoints.sae_dstaddrlen = addr.addrlen;
|
||||
|
||||
rc = connectx(sockfd, &endpoints, SAE_ASSOCID_ANY,
|
||||
CONNECT_RESUME_ON_READ_WRITE | CONNECT_DATA_IDEMPOTENT,
|
||||
NULL, 0, NULL, NULL);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
rc = connect(sockfd, &addr.sa_addr, addr.addrlen);
|
||||
}
|
||||
|
||||
if(-1 == rc)
|
||||
error = SOCKERRNO;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user