Improving TLS communication with a timer#768
Open
mruprich wants to merge 1 commit intolavv17:masterfrom
Open
Conversation
lavv17
reviewed
Oct 31, 2025
| if(conn && conn->data_sock!=-1) | ||
| if(conn && conn->data_sock!=-1) { | ||
| SetSocketBuffer(conn->data_sock); | ||
| SetTCPNodelay(conn->data_sock); |
Owner
There was a problem hiding this comment.
Does it always give good results? Measured?
lavv17
reviewed
Oct 31, 2025
| goodbye_done = true; | ||
| return DONE; | ||
| if (!ssl_shutdown_timer) { | ||
| ssl_shutdown_timer = new Timer(0, 200); |
Owner
There was a problem hiding this comment.
Is 200 ms always enough? Maybe 1 sec is a better default. And a setting would be nice to have.
lavv17
reviewed
Oct 31, 2025
| } else if (res == GNUTLS_E_AGAIN || res == GNUTLS_E_INTERRUPTED) { | ||
| /* In ideal world we would not need this if, but windows does not | ||
| * send close-notify, so do not wait on server close-notify */ | ||
| if (gnutls_record_get_direction(session) == 0) { |
lavv17
requested changes
Oct 31, 2025
| ProtoLog::LogError(1,"setsockopt(TCP_MAXSEG,%d): %s",socket_maxseg,strerror(errno)); | ||
| #endif | ||
| } | ||
| void Networker::SetTCPNodelay(int sock) |
| res = gnutls_bye(session,GNUTLS_SHUT_RDWR); | ||
| if (res == GNUTLS_E_SUCCESS) { | ||
| if (ssl_shutdown_timer) { | ||
| ssl_shutdown_timer->Stop(); |
Owner
There was a problem hiding this comment.
better delete the timer, it will not be needed anymore
| #define BUFFER_SSL_H | ||
|
|
||
| #include "buffer.h" | ||
| #include "Timer.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adding a bit of code on top of #754 . This following change is also authored by Tomas from the previous PR. Some TLS implementations do not send close_notify and we could wait indefinitely for something that never happens.
Also, setting the socket flags to TCP_NODELAY which basically disables the Nagle algorithm.