Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull Request: Improved Handshake Handling #40

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

FredRokk
Copy link

@FredRokk FredRokk commented Jun 21, 2024

Overview

I have made changes to how handshakes are handled to address issues encountered during high traffic on the server. Previously, the server was too quick to reject handshakes from clients, causing problems.

Issue

During high traffic, I discovered that on some occasions, the GNUTLS library would return GNUTLS_E_AGAIN but errno would also be set to something other than EAGAIN, resulting in handshake failures.

Solution

To resolve this, I implemented a check to ensure we retry when GNUTLS indicates to do so. Additionally, I've added retries for the PUSH, PULL functions, and early termination failures due to high throughput on the server socket.

Changes Made

Implemented retry logic when GNUTLS_E_AGAIN is returned, regardless of errno.
Added retry mechanisms for PUSH, PULL functions, and early termination scenarios.
Impact
These changes should improve the reliability of handshake processing, particularly under high server load.

This version maintains the original intent while improving clarity and structure.

FredRokk and others added 3 commits June 13, 2024 15:00
… like GNUTLS_E_AGAIN, GNUTLS_E_PUSH_ERROR, GNUTLS_E_PULL_ERROR, and GNUTLS_E_PREMATURE_TERMINATION which are retryable weren't retried. Which let to way too many rejections on handshake. Also adjusted timings, to reflect more real world conditions
Added a fix where handshakes could prematurly fail
The problem was that some errors from GNUTLS weren't handled correctly
Now we will retry on errors that is ultimatly retryable
Errors in question: GNUTLS_E_AGAIN, GNUTLS_E_PULL_ERROR, GNUTLS_E_PUSH_ERROR, and GNUTLS_E_PREMATURE_TERMINATION.

Am now seeing more consistent handshake behavour when having a lot of traffic
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.

1 participant