feat: Implement LdapStream, begin event loop

This commit is contained in:
selfhoster selfhoster 2026-09-01 17:57:42 +02:00
commit 1ef02c58dd
8 changed files with 152 additions and 56 deletions

View file

@ -2,21 +2,14 @@
mod cli;
mod error;
mod ldap;
mod listener;
mod stream;
use cli::CliArgs;
use error::GlobalError;
use ldap::ldap_handler;
use listener::ListenerPath;
use stream::AbstractStream;
#[tracing::instrument(name = "client", skip(s), fields(session = %s.session))]
async fn client(s: AbstractStream) {
tracing::info! {
remote_addr = ?s.remote_addr,
"New client connection"
};
}
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), GlobalError> {
@ -34,8 +27,8 @@ async fn main() -> Result<(), GlobalError> {
// If the connection is None, it's because the client aborted early
// so there's nothing to do about it.
while let Some(stream) = listener.accept().await? {
client(stream).await;
while let Some(stream) = listener.accept_ldap().await? {
tokio::spawn(ldap_handler(stream));
}
Ok(())