feat: Implement LdapStream, begin event loop
This commit is contained in:
parent
d30df04064
commit
1ef02c58dd
8 changed files with 152 additions and 56 deletions
15
src/main.rs
15
src/main.rs
|
|
@ -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(())
|
||||
|
|
|
|||
Loading…
Reference in a new issue