yarpc / yarpc-go

A message passing platform for Go
MIT License
405 stars 103 forks source link

[7/n] tlsmux: add non-blocking mux listener #2139

Closed jronak closed 2 years ago

jronak commented 2 years ago

Currently, a new connection accepted from the original listener goes through muxer, sniffs bytes and completes handshake (if tls connection). The above flow is synchronous, and a slow connection can block/slowdown sniffing & handshake, which causes the head of the line blocking issue for other connections waiting to get muxed. To avoid such issues, this PR creates an async server which accepts connections and spawns a go-routine to handle connection muxing.

Async server starts on the first Accept method call and gracefully stops on the Close method call.

codecov[bot] commented 2 years ago

Codecov Report

Merging #2139 (0100ce7) into dev (3fa2cb7) will decrease coverage by 0.02%. The diff coverage is 91.11%.

@@            Coverage Diff             @@
##              dev    #2139      +/-   ##
==========================================
- Coverage   87.74%   87.71%   -0.03%     
==========================================
  Files         254      254              
  Lines       14148    14182      +34     
==========================================
+ Hits        12414    12440      +26     
- Misses       1341     1347       +6     
- Partials      393      395       +2     
Impacted Files Coverage Δ
transport/internal/tlsmux/listener.go 88.15% <91.11%> (+0.06%) :arrow_up:
transport/tchannel/peer.go 97.36% <0.00%> (-2.64%) :arrow_down:
peer/hashring32/internal/hashring32/hashring32.go 96.21% <0.00%> (-1.09%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3fa2cb7...0100ce7. Read the comment docs.