Skip to content

Conversation

smittals2
Copy link
Contributor

@smittals2 smittals2 commented Aug 13, 2025

Issues:

CryptoAlg-3287
CryptoAlg-3331

Description of changes:

Added

  • BIO_CTRL_DGRAM_SET_RECV_TIMEOUT
  • BIO_CTRL_DGRAM_GET_RECV_TIMEOUT
  • BIO_CTRL_DGRAM_SET_SEND_TIMEOUT
  • BIO_CTRL_DGRAM_GET_SEND_TIMEOUT

Testing:

  • Read timeout test added
  • For Write timeout, the APIs are tested but the behavior is not. Filling the send buffer to force a timeout with UDP is unreliable across different OS (buffers can be very large, or instead of timing out OS starts dropping packets).

Callouts:

  • We also change how we track error states for datagram sockets. Previously, on read/write errors, we would only store certain errors if they were considered "retryable" or non-fatal. In the case of timeouts, WSAETIMEDOUT on Windows is not considered retriable and therefore was never tracked in our error handling, making that code path unreachable. This PR changes this behavior to store the error value regardless of whether it is retriable, so we can always track the error state.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

@smittals2 smittals2 changed the title Implement read/write timeouts for BIO datagram Implement get/set for read/write timeouts for BIO datagram Aug 13, 2025
@smittals2 smittals2 changed the title Implement get/set for read/write timeouts for BIO datagram Implement read/write timeouts for BIO datagram Aug 13, 2025
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

@smittals2 smittals2 marked this pull request as ready for review August 13, 2025 21:06
@smittals2 smittals2 requested a review from a team as a code owner August 13, 2025 21:06
@smittals2 smittals2 requested a review from justsmth August 13, 2025 21:06
@codecov-commenter
Copy link

codecov-commenter commented Aug 13, 2025

Codecov Report

❌ Patch coverage is 72.05882% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.71%. Comparing base (3b1e95e) to head (cf2039d).

Files with missing lines Patch % Lines
crypto/bio/dgram.c 68.51% 17 Missing ⚠️
crypto/bio/bio_socket_test.cc 85.71% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2610      +/-   ##
==========================================
- Coverage   78.72%   78.71%   -0.01%     
==========================================
  Files         646      646              
  Lines      111213   111275      +62     
  Branches    15710    15721      +11     
==========================================
+ Hits        87548    87593      +45     
- Misses      22973    22989      +16     
- Partials      692      693       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@smittals2 smittals2 requested a review from justsmth August 14, 2025 19:16
@smittals2 smittals2 requested a review from justsmth August 19, 2025 01:09
Comment on lines +729 to +732
#define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */
#define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */
#define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */
#define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36 /* getsockopt, essentially */
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit:

Suggested change
#define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */
#define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */
#define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */
#define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36 /* getsockopt, essentially */
#define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 // setsockopt, essentially
#define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 // getsockopt, essentially
#define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 // setsockopt, essentially
#define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36 // getsockopt, essentially

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants