Skip to content

Commit 548d75d

Browse files
committed
Fix Global connection counter for health checks
1 parent 77c591c commit 548d75d

File tree

2 files changed

+55
-7
lines changed

2 files changed

+55
-7
lines changed

CHANGELOG.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
11+
### Added
12+
13+
* Now keeping a change log in the `CHANGELOG.md` file.
14+
* Created Dockerfile for creation of Container Images
15+
* Added a Sequence diagram
16+
* Added the possibility to connect `via` upstream Proxy (https://github.com/git001/tls-proxy-tunnel/commit/5737e29743d814c81fcd91a62ff660f3899a5e08)
17+
* Add simple HTTP/1.1 health check (https://github.com/git001/tls-proxy-tunnel/commit/1f533cc8fb576ff8e4bab4027dc7ebc2662ccec6)
18+
* Add parsing and getting of environment variables (https://github.com/git001/tls-proxy-tunnel/commit/8e01d2cc78dd1895583517f596982e64df51683a)
19+
* Add simple k6 tests (https://github.com/git001/tls-proxy-tunnel/commit/4fd5eee5c9b2e18e0a9b53865309080b19c395b2)
20+
* Add Global connection counter (https://github.com/git001/tls-proxy-tunnel/commit/ec8db36d9365dfc3970ac53effa2ac77a7be0f8f)
21+
* Add Arc Semaphore to limit clients ( https://github.com/git001/tls-proxy-tunnel/commit/2a9c5f1353af131d118bee2077848791a95c9fc7 , https://github.com/git001/tls-proxy-tunnel/commit/9adb9b999152d013de27a1851d142e75336101ba)
22+
* Fix Global connection counter for health checks
23+
24+
### Changed
25+
26+
* Rename the forked project `layer4-proxy` to `tls-proxy-tunnel`
27+
28+
-------
29+
30+
## Previous versions from layer4-proxy
31+
32+
[0.1.7]: https://code.kiers.eu/jjkiers/layer4-proxy/compare/v0.1.1...v0.1.7
33+
34+
35+
36+
Types of changes:
37+
38+
* `Added` for new features.
39+
* `Changed` for changes in existing functionality.
40+
* `Deprecated` for soon-to-be removed features.
41+
* `Removed` for now removed features.
42+
* `Fixed` for any bug fixes.
43+
* `Security` in case of vulnerabilities.

src/servers/protocol/tcp.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,18 @@ async fn accept(inbound: TcpStream, proxy: Arc<Proxy>) -> Result<(), Box<dyn Err
100100

101101
match upstream.process(inbound, proxy.clone()).await {
102102
Ok(_) => {
103-
let old = GLOBAL_THREAD_COUNT.fetch_sub(1, Ordering::SeqCst);
104-
info!(
105-
"Connection closed for {:?}, num :{:?}: Current Connections :{:?}",
106-
upstream_name, old, GLOBAL_THREAD_COUNT
107-
);
108-
//drop(permit);
109-
Ok(())
103+
if proxy.default_action.contains("health") {
104+
debug!("Health check request");
105+
Ok(())
106+
} else {
107+
let old = GLOBAL_THREAD_COUNT.fetch_sub(1, Ordering::SeqCst);
108+
info!(
109+
"Connection closed for {:?}, num :{:?}: Current Connections :{:?}",
110+
upstream_name, old, GLOBAL_THREAD_COUNT
111+
);
112+
//drop(permit);
113+
Ok(())
114+
}
110115
}
111116
Err(e) => {
112117
let old = GLOBAL_THREAD_COUNT.fetch_sub(1, Ordering::SeqCst);

0 commit comments

Comments
 (0)