Commit Graph

4 Commits

Author SHA1 Message Date
bagas 61a4791bcb fix(port, session): harden port registry and fix concurent allocation (#155)
SonarQube Scan / SonarQube Trigger (push) Successful in 3m53s
Critical fixes to the port registry that prevented correct tunnel port allocation under concurrency and allowed out-of-range ports to be claimed.

Bug Fixes:
- Fixed AddRange infinite loop when endPort == 65535 (uint16 wraparound)
 -Fixed Claim bypassing the allowed range — now rejects out-of-range ports
- Fixed Unassigned handing out the same port to concurrent callers — now reserves atomically
- Fixed SetStatus silently creating entries for unknown ports — now returns an error

Reviewed-on: #155
Co-authored-by: Bagas <bagas@fossy.my.id>
Co-committed-by: Bagas <bagas@fossy.my.id>
2026-07-19 10:59:22 +07:00
bagas a3f6baa6ae test: check and handle error for testing 2026-01-27 16:28:20 +07:00
bagas ee1dc3c3cd chore(tests): migrate to Testify for mocking and assertions 2026-01-27 16:28:20 +07:00
bagas a55ff5f6ab test(port): add unit tests for port behavior 2026-01-27 16:28:20 +07:00