-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix: single-connection mode connection reestablishment #39
Conversation
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.
tacacs-plus/src/inner.rs
Outdated
}); | ||
|
||
// wait for server to bind to address | ||
notify.notified().await; |
There was a problem hiding this comment.
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+ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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