fix: take the Winsock keepalive constants from the header that defines them - #728
Conversation
…s them SolidSyslogWinsockTcpStream.c included <mstcpip.h> for TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT. That header cannot supply them — the SDK defines all three in <ws2ipdef.h>, reached only via <ws2tcpip.h>, and mstcpip.h's include list leads nowhere near it. The file compiled anyway because SolidSyslogWinsockTcpStreamInternal.h pulls <ws2tcpip.h> in for the test-seam typedefs, so a production constant was riding on an internal header the file never names. Include <ws2tcpip.h> directly and drop the inert <mstcpip.h>, matching SolidSyslogWinsockDatagram.c. The clang-format off/on guard goes with it: WS2tcpip.h includes <winsock2.h> itself, so the ordering constraint the old comment described never existed and the block sorts alphabetically. Both comments now name the defining header. The MISRA suppression pins for the file shift by two lines. Verified on Windows against SDK 10.0.26100.0: cl /W4 /WX clean, and a probe with only <winsock2.h> + <mstcpip.h> fails to find all three macros. Closes #726 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe Windows TCP stream now includes ChangesWinsock keepalive include correction
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Platform/Windows/Source/SolidSyslogWinsockTcpStream.c`:
- Around line 245-246: Update the Winsock comment near the keepalive
socket-option handling to state that setsockopt is declared in <winsock2.h>,
while TCP_KEEPIDLE, TCP_KEEPINTVL, and TCP_KEEPCNT come from <ws2ipdef.h> via
<ws2tcpip.h>. Document that TCP_KEEPCNT requires Windows 10 version 1703 and
TCP_KEEPIDLE/TCP_KEEPINTVL require version 1709, while preserving the existing
note about no TCP_USER_TIMEOUT analogue.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: c736e25f-0a54-47e2-a6f2-b6c8fae7a574
📒 Files selected for processing (2)
Platform/Windows/Source/SolidSyslogWinsockTcpStream.cmisra_suppressions.txt
The parenthetical sat next to setsockopt, so "defined in <ws2ipdef.h>" could be read as describing setsockopt — which is declared in <winsock2.h>. Put the three constants up front as the subject instead. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
☀️ Quality Summary Created by Quality Monitor v4.15.0 (#82d77af). More details are shown in the GitHub Checks Result. |
Problem
Platform/Windows/Source/SolidSyslogWinsockTcpStream.cincluded<mstcpip.h>for
TCP_KEEPIDLE,TCP_KEEPINTVLandTCP_KEEPCNT. That header cannot supplythem.
Verified against Windows SDK 10.0.26100.0:
shared\ws2ipdef.h(lines 980-982), reachedfrom public headers via
um\WS2tcpip.h:44.TCP_KEEPIDLEis an alias for theolder
TCP_KEEPALIVE.<mstcpip.h>provides the ioctl-style interface instead —struct tcp_keepaliveandSIO_KEEPALIVE_VALS. Its whole include list is<winapifamily.h>and<nldef.h>, andnldef.hincludes only<winapifamily.h>. There is no path frommstcpip.htows2ipdef.h.SolidSyslogWinsockTcpStreamInternal.h,which pulls
<ws2tcpip.h>in for the test-seam typedefs. A productionconstant was riding on an internal header the file never names — a future
tidy of that header's includes would have broken the build for a reason
nobody would look for.
Change
Include
<ws2tcpip.h>directly, drop the inert<mstcpip.h>, and correct bothcomments to name the defining header.
The
clang-format off/onguard goes with it.WS2tcpip.h:43includes<winsock2.h>itself, so the ordering constraint the old comment asserted neverexisted, and
winsock2.h/ws2tcpip.hsort alphabetically into the plainblock. The file now matches
SolidSyslogWinsockDatagram.c:5, which alreadyincluded
<ws2tcpip.h>this way.misra_suppressions.txtpins for the file shift by two lines.No sibling carries the same mistake —
<mstcpip.h>appeared only in this file.Verification
Done on Windows, since the point of the change is that the translation unit
compiles against the real SDK.
cl /W4 /WX, SDK 10.0.26100.0clang-format --dry-run --Werror(CI container, v19.1.7)Supporting probe, same toolchain:
<winsock2.h>+<mstcpip.h>onlyerror C2065: 'TCP_KEEPIDLE': undeclared identifier, and the other two<ws2tcpip.h><mstcpip.h>deleted, nothing else changed/W4The full
scripts/misra_renumber.pycppcheck pass was not run locally — theshift is uniform and every line's content was matched, so
analyze-cppcheckisthe check on that.
Closes #726
🤖 Generated with Claude Code
Summary by CodeRabbit