if ( (sock = socket(SOCK_STREAM, AF_INET, 0)) < 0
&& setsockopt(sock, IPPROTO_TCP, TCP_FASTOPEN, &backlog, sizeof(backlog))
)
- tcp_fastopen_ok = TRUE;
+ f.tcp_fastopen_ok = TRUE;
close(sock);
# endif
}
this peer, can send data in the SYN packet. The peer can send data
before it gets our ACK of its SYN,ACK - the latter is useful for
the SMTP banner. Other (than SMTP) cases of TCP connections can
-possibly use the data-on-syn, so support that too. */
+possibly use the data-on-syn, so support that too.
-if (fastopen_blob && tcp_fastopen_ok)
+This is a Linux implementation. It might be useable on FreeBSD; I have
+not checked. I think MacOS has a "connectx" call for this purpose,
+rather than using "sendto" ? */
+
+if (fastopen_blob && f.tcp_fastopen_ok)
{
if ((rc = sendto(sock, fastopen_blob->data, fastopen_blob->len,
MSG_FASTOPEN | MSG_DONTWAIT, s_ptr, s_len)) >= 0)
debug_printf("non-TFO mode connection attempt to %s, %lu data\n",
address, (unsigned long)fastopen_blob->len);
/*XXX also seen on successful TFO, sigh */
- tcp_out_fastopen = fastopen_blob->len > 0 ? 2 : 1;
+ tcp_out_fastopen = fastopen_blob->len > 0 ? TFO_USED : TFO_ATTEMPTED;
}
else if (errno == EINPROGRESS) /* expected if we had no cookie for peer */
/* seen for no-data, proper TFO option, both cookie-request and with-cookie cases */
fastopen_blob->len > 0 ? "with" : "no");
if (!fastopen_blob->data)
{
- tcp_out_fastopen = 1; /* we tried; unknown if useful yet */
+ tcp_out_fastopen = TFO_ATTEMPTED; /* we tried; unknown if useful yet */
rc = 0;
}
else
can't think of any other way of doing this. It converts a connection refused
into a timeout if the timeout is set to 999999. */
-if (running_in_test_harness && save_errno == ECONNREFUSED && timeout == 999999)
+if (f.running_in_test_harness && save_errno == ECONNREFUSED && timeout == 999999)
{
rc = -1;
save_errno = EINTR;