• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

emqx / esockd / 601
67%
master: 67%

Build:
Build:
LAST BUILD BRANCH: feat/conn-rate-token-refund
DEFAULT BRANCH: master
Ran 25 Aug 2026 04:09PM UTC
Jobs 3
Files 22
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

25 Aug 2026 04:06PM UTC coverage: 68.867%. First build
601

Pull #228

github

terry-xiaoyu
feat: refund connection-rate token for connections that die before engaging

A connection whose peer FIN/RSTs before any application data was exchanged
consumes a connection-rate token at accept but never engages: under a storm
of dead sockets the limiter bucket can be driven into debt, pausing every
acceptor even though no real connection ever established.

Refund such tokens:
- esockd_limiter:refund/1 returns one token only while the bucket is in debt
  (tokens < 0), so no free tokens are ever created; missing buckets are no-op.
- esockd_transport:upgrade/2 exits the connection process with the
  {shutdown, {pre_establishment, Reason}} marker when an upgrade fun (e.g.
  the TLS handshake) fails with a peer-gone reason (closed/einval/enotconn),
  so TLS dead connections are detected by esockd itself, without any upper
  layer cooperation.
- esockd_connection_sup unwraps the marker: the inner reason is counted in
  shutdown_count as before, and the token is refunded. set_conn_limiter/2
  hands the limiter bucket to the sup (process dictionary, hot-upgrade safe).
- esockd_listener_sup wires the bucket to the connection sup at listener
  start and on set_max_conn_rate reconfiguration.

The emqx side (emqx_connection) produces the same marker for plain-TCP
connections that die before their first bytes (see the paired PR).
Pull Request #228: feat: refund connection-rate token for connections that die before engaging

15 of 22 new or added lines in 4 files covered. (68.18%)

772 of 1121 relevant lines covered (68.87%)

67.03 hits per line

Uncovered Changes

Lines Coverage ∆ File
6
52.98
src/esockd_transport.erl
1
67.13
src/esockd_connection_sup.erl
Jobs
ID Job ID Ran Files Coverage
1 601.1 25 Aug 2026 04:09PM UTC 22
68.87
GitHub Action Run
2 601.2 25 Aug 2026 04:09PM UTC 22
69.05
GitHub Action Run
3 601.3 25 Aug 2026 04:09PM UTC 22
69.11
GitHub Action Run
Source Files on build 601
  • Tree
  • List 22
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Pull Request #228
  • Next Build on (#603)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc