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

fix: single-connection mode connection reestablishment #39

Merged
merged 8 commits into from
Sep 10, 2024

Conversation

5t0n3
Copy link
Contributor

@5t0n3 5t0n3 commented Sep 5, 2024

Previously there was no logic to handle an existing connection that was e.g. closed. This PR handles that case by attempting to read from the underlying connection before writing to it, and reestablishing on an EOF condition or specific errors.

Single-connection mode was also enabled on the TACACS+ NG test server image, since I didn't realize it wasn't enabled by default.

Fixes #38

Previously there was no logic to handle an existing connection that was
e.g. closed, so that was added in in this commit along with a
corresponding test.
@5t0n3 5t0n3 self-assigned this Sep 5, 2024
});

// wait for server to bind to address
notify.notified().await;
Copy link
Contributor

Choose a reason for hiding this comment

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

these are nice to coordinate between threads (especially in tests)

},

// if there's data still available, the connection is still open, although
// this shouldn't happen in the context of TACACS+
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should be debug/trace log here? Would this be possible to hit in a multi-threaded context? Or would it hit the mutex lock?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be prevented by the mutex since it's locked for the full session within Client

@5t0n3 5t0n3 merged commit 00d975a into cPacketNetworks:main Sep 10, 2024
5 checks passed
@5t0n3 5t0n3 deleted the client-connection-reestablishment branch September 10, 2024 17:51
@5t0n3 5t0n3 removed their assignment Jan 5, 2025
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.

Client should attempt to open a new connection when the old one expires
2 participants