Files
macports-ports/net/httping/files/patch-tcp.c.diff
T
2025-08-01 21:44:17 -04:00

27 lines
1.2 KiB
Diff

# Enable TCP Fast Open on macOS
# See: https://github.com/folkertvanheusden/HTTPing/pull/48
--- tcp.c.orig 2024-05-08 01:54:44
+++ tcp.c 2024-05-10 16:16:28
@@ -161,15 +161,15 @@
/* connect to peer */
if (tfo && *tfo)
{
-#if defined(__FreeBSD__)
- int enable = 1;
- setsockopt(fd, IPPROTO_TCP, TCP_FASTOPEN, &enable, sizeof(enable));
+#if defined(__FreeBSD__) || defined(__APPLE__)
+ int enable = 1;
+ setsockopt(fd, IPPROTO_TCP, TCP_FASTOPEN, &enable, sizeof(enable));
- rc = sendto(fd, msg, msg_len, 0, ai->ai_addr, ai->ai_addrlen);
+ rc = sendto(fd, msg, msg_len, 0, ai->ai_addr, ai->ai_addrlen);
#else
rc = sendto(fd, msg, msg_len, MSG_FASTOPEN, ai -> ai_addr, ai -> ai_addrlen);
#endif
-
+
if (rc == msg_len)
*msg_accepted = 1;
if (errno == 0)