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

feat: support so_reuseaddr #275

Closed
wants to merge 11 commits into from
Closed

feat: support so_reuseaddr #275

wants to merge 11 commits into from

Conversation

zhongweikang
Copy link
Contributor

@zhongweikang zhongweikang commented Nov 19, 2021

1. Are you opening this pull request for bug-fixes, optimizations or new feature?

new feature

2. Please describe how these code changes achieve your intention.

支持 so_reuseaddr 可以使得 gnet 在重启过程中,不必因为 timewait 原因而导致:bind: address already in use

3. Please link to the relevant issues (if any).

#266
#272

4. Which documentation changes (if any) need to be made/updated because of this PR?

4. Checklist

  • I have squashed all insignificant commits.
  • I have commented my code for explaining package types, values, functions, and non-obvious lines.
  • I have written unit tests and verified that all tests passes (if needed).
  • I have documented feature info on the README (only when this PR is adding a new feature).
  • (optional) I am willing to help maintain this change if there are issues with it later.

Copy link
Owner

@panjf2000 panjf2000 left a comment

Choose a reason for hiding this comment

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

加一下测试。

@zhongweikang
Copy link
Contributor Author

已经删除了 SetReuseport 中的 so_reuseaddr 部分,并新增了测试

@panjf2000
Copy link
Owner

你自己测试过了吗?

@zhongweikang
Copy link
Contributor Author

测试过了,设置了 so_reuseaddr 时,即便处于 timewait 状态,依然可以正常启动服务(此时没有设置 so_reuseport,主从Reactor也都在正常工作)。

@panjf2000
Copy link
Owner

麻烦 rebase 一下最新的 dev 分支代码。

@zhongweikang
Copy link
Contributor Author

Done

@panjf2000
Copy link
Owner

你这不是 rebase 啊,现在的 git log 不对,这个 PR 也不对了,你重新在我的 dev 分支上拉一个分支再修改吧。

@zhongweikang
Copy link
Contributor Author

不好意思,那我重开一个

@zhongweikang zhongweikang mentioned this pull request Nov 22, 2021
5 tasks
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