Compare commits

..

No commits in common. "27f611990519f77c482f259483674614198dbdd6" and "7851d6bb1256639c869a7a00a83120d2f3f20f79" have entirely different histories.

2 changed files with 8 additions and 17 deletions

View File

@ -3,7 +3,7 @@ use russh::keys::PublicKey;
use tokio::select;
use tokio::task::JoinHandle;
use tokio_util::sync::CancellationToken;
use tracing::{debug, error};
use tracing::{debug, warn};
#[derive(Debug, Clone)]
pub struct Ldap {
@ -51,10 +51,9 @@ impl Ldap {
select! {
res = conn.drive() => {
if let Err(err) = res {
error!("LDAP connection error: {}", err);
warn!("LDAP connection error: {}", err);
} else {
error!("LDAP connection lost");
token.cancel();
debug!("LDAP drive has stopped, this should not happen?");
}
}
_ = token.cancelled() => {

View File

@ -15,26 +15,18 @@ use siranga::web::{ForwardAuth, Service};
use tokio::net::TcpListener;
use tokio::select;
use tokio_util::sync::CancellationToken;
use tracing::{debug, error, info, warn};
use tracing::{error, info, warn};
use tracing_subscriber::EnvFilter;
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;
async fn shutdown_task(token: CancellationToken) {
select! {
_ = tokio::signal::ctrl_c() => {
debug!("Received SIGINT");
}
_ = token.cancelled() => {
debug!("Application called for graceful shutdown");
}
}
tokio::signal::ctrl_c()
.await
.expect("Failed to listen for ctrl-c event");
info!("Starting graceful shutdown");
token.cancel();
select! {
_ = tokio::time::sleep(Duration::from_secs(5)) => {}
_ = tokio::signal::ctrl_c() => {}
}
tokio::time::sleep(Duration::from_secs(5)).await;
}
#[tokio::main]