Skip to content

{stream,transport}: fix connection overwriting when a client uses the same port to connect. #131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 31, 2023

Conversation

Leoyoungxh
Copy link
Contributor

The server's transport maintains an addrToConn map based only on the client's IP-Port. When a client connects to different ports on the server using the same local IP-port, it causes the connections in the server transport's addrToConn map to be overwritten, leading to a "Can't find conn by addr" error in the streaming service.

So now, the combination of the client's IP-Port and the server's IP-Port is used as the addrToConn map key.

… same port to connect.

The server's transport maintains an `addrToConn` map based only on the client's IP-Port. When a client connects to different ports on the server using the same local IP-port, it causes the connections in the server transport's `addrToConn` map to be overwritten, leading to a "Can't find conn by addr" error in the streaming service.

So now, the combination of the client's IP-Port and the server's IP-Port is used as the `addrToConn` map key.
@codecov
Copy link

codecov bot commented Oct 31, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (369c60d) 85.60258% compared to head (96c35b6) 85.46797%.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main        #131         +/-   ##
===================================================
- Coverage   85.60258%   85.46797%   -0.13462%     
===================================================
  Files            188         189          +1     
  Lines          16114       16123          +9     
===================================================
- Hits           13794       13780         -14     
- Misses          1755        1785         +30     
+ Partials         565         558          -7     
Flag Coverage Δ
unittests 85.46797% <87.50000%> (-0.13462%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
codec_stream.go 83.97626% <100.00000%> (ø)
internal/addrutil/addrutil.go 100.00000% <100.00000%> (ø)
stream/server.go 82.60870% <100.00000%> (-3.55483%) ⬇️
transport/server_transport_tcp.go 77.11864% <100.00000%> (ø)
transport/tnet/server_transport_tcp.go 72.89720% <100.00000%> (ø)
transport/server_transport_stream.go 61.29032% <85.71429%> (+1.91532%) ⬆️
transport/tnet/server_transport.go 84.61538% <72.72727%> (-0.51977%) ⬇️

... and 6 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@sandyskies sandyskies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request is cherry-picked from internal version. Reivew and verification have already been done inside. There is not necessary to do that again.

@sandyskies sandyskies merged commit d9b904d into trpc-group:main Oct 31, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants