diff options
author | Alex Auvolat <alex@adnab.me> | 2021-12-07 16:37:22 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-12-07 16:37:22 +0100 |
commit | ccb4e87658f622edbd57cc2b5a058c969643bfe2 (patch) | |
tree | a958a0221062a21e7db3859e7b6843d7e5bd8b7c /src/https.rs | |
parent | cd7e5ad034b75d659d4d87a752ab7b11cf75de12 (diff) | |
download | tricot-ccb4e87658f622edbd57cc2b5a058c969643bfe2.tar.gz tricot-ccb4e87658f622edbd57cc2b5a058c969643bfe2.zip |
Round robin backends
Diffstat (limited to 'src/https.rs')
-rw-r--r-- | src/https.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/https.rs b/src/https.rs index c80d51c..a62ebea 100644 --- a/src/https.rs +++ b/src/https.rs @@ -1,5 +1,5 @@ use std::net::SocketAddr; -use std::sync::Arc; +use std::sync::{atomic::Ordering, Arc}; use anyhow::Result; use log::*; @@ -108,10 +108,13 @@ async fn handle( .as_ref() .map(|x| x.len() as i32) .unwrap_or(0)), + ent.calls.load(Ordering::SeqCst), ) }); if let Some(proxy_to) = ent { + proxy_to.calls.fetch_add(1, Ordering::SeqCst); + let to_addr = format!("http://{}", proxy_to.target_addr); info!("Proxying {} {} -> {}", host, path, to_addr); |