Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/pc/protocols/tcpip_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#pragma comment(lib, "iphlpapi.lib")
#define tcpip_errno WSAGetLastError()
#define ERRNO_EAGAIN WSAETIMEDOUT
#define SIO_TCP_SET_ACK_FREQUENCY _WSAIOW(IOC_VENDOR, 23)

#else

Expand Down Expand Up @@ -1116,6 +1117,16 @@ int tcpipPlatformConnect(const char *devPathRead, const char *devPathWrite, void
return -1;
}

#if (defined(_WIN32) || defined(_WIN64) )
// Force immediate ACKs
int freq = 1;
DWORD bytes;
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The magic number 23 in _WSAIOW(IOC_VENDOR, 23) lacks explanation. Add a comment explaining that this is the Windows-specific code for TCP_MAXRT (or the specific ACK behavior being configured), as this vendor-specific ioctl code is not self-documenting.

Suggested change
DWORD bytes;
DWORD bytes;
// The magic number 23 in _WSAIOW(IOC_VENDOR, 23) is a Windows-specific vendor IOCTL code
// used to configure TCP immediate ACK behavior (sometimes referred to as TCP_MAXRT).
// This is not a standard IOCTL and is not self-documenting; see Microsoft documentation for details.

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this as a macro on top

if(WSAIoctl(sock, SIO_TCP_SET_ACK_FREQUENCY, &freq, sizeof(freq), NULL, 0, &bytes, NULL, NULL) != 0)
{
mvLog(MVLOG_WARN, "WSAIoctl SIO_TCP_SET_ACK_FREQUENCY could not be set");
}
#endif

#if defined(TCP_QUICKACK)
if(tcpip_setsockopt(sock, IPPROTO_TCP, TCP_QUICKACK, &on, sizeof(on)) < 0)
{
Expand Down
Loading