Skip to content
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

fix(qconnection): fix port 0 can't be bound repeatedly #322

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

eareimu
Copy link
Contributor

@eareimu eareimu commented Nov 25, 2024

现今,绑定端口0时会将 地址,端口0 而不是实际的 地址,端口 写进USC_REGISTRY,导致

  • 没有启用复用时,端口0不能被重复绑定,因为USC_REGISTRY中存在了一个port0的条目
  • 复用端口时,USC的销毁行为异常——因为在绑定端口0时,真正的地址没有被写进USC_REGISTRY,而是全部inset(port0, arc_usc)

get_or_create_usc中为端口0特别处理,不违背它的语义,反正端口0每次都是create_new永远不会reuse,别的端口才可能被reuse。如果在外面判断就显得麻烦了,所以在get_or_create_usc中处理

create_new也优化了下,依赖于OS不让重复bind同一地址的特性,不写代码判定是否已经绑定过

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 93.22034% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
qconnection/src/usc.rs 96.29% 2 Missing ⚠️
qrecovery/src/recv/reader.rs 75.00% 1 Missing ⚠️
qrecovery/src/send/writer.rs 0.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
qrecovery/src/recv/reader.rs 53.06% <75.00%> (+9.20%) ⬆️
qrecovery/src/send/writer.rs 26.66% <0.00%> (ø)
qconnection/src/usc.rs 98.49% <96.29%> (+1.94%) ⬆️

... and 5 files with indirect coverage changes

@eareimu eareimu force-pushed the fix/bind_port_0 branch 2 times, most recently from 94c1058 to 0d91f21 Compare November 25, 2024 04:16
@eareimu eareimu changed the title fix(qconnection): fix port 0 can't be bound repeatedly WIP fix(qconnection): fix port 0 can't be bound repeatedly Nov 25, 2024
@eareimu eareimu changed the title WIP fix(qconnection): fix port 0 can't be bound repeatedly ix(qconnection): fix port 0 can't be bound repeatedly Nov 26, 2024
@eareimu eareimu changed the title ix(qconnection): fix port 0 can't be bound repeatedly fix(qconnection): fix port 0 can't be bound repeatedly Nov 26, 2024
Copy link
Contributor

@huster-zhangpeng huster-zhangpeng left a comment

Choose a reason for hiding this comment

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

ok

@huster-zhangpeng huster-zhangpeng merged commit f11e1d0 into main Nov 27, 2024
9 checks passed
@huster-zhangpeng huster-zhangpeng deleted the fix/bind_port_0 branch November 27, 2024 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants