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

Support connect on socket create #2574

Merged
merged 1 commit into from
Jun 13, 2024
Merged

Conversation

chenBright
Copy link
Contributor

@chenBright chenBright commented Mar 17, 2024

What problem does this PR solve?

Issue Number:

Problem Summary:

目前直接使用client Socket,存在两个问题:

  1. 不能先连接对端,只能在第一次写入的时候连接。
  2. 虽然可以先通过tcp connect获取一个fd,再通过SocketOptions.fd创建一个Socket对象。但是这种方式不支持ssl。

What is changed and the side effects?

Changed:

支持在Socket::Create中连接对端,同时支持ssl。

Side effects:

  • Performance effects(性能影响):

  • Breaking backward compatibility(向后兼容性):


Check List:

  • Please make sure your changes are compilable(请确保你的更改可以通过编译).
  • When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
  • Please follow Contributor Covenant Code of Conduct.(请遵循贡献者准则).

src/brpc/socket.h Outdated Show resolved Hide resolved
@wwbmmm
Copy link
Contributor

wwbmmm commented Mar 21, 2024

LGTM

@chenBright chenBright force-pushed the connect_on_create branch 2 times, most recently from 64b66af to 2ee220d Compare March 26, 2024 14:52
@chenBright
Copy link
Contributor Author

Socket在Create中建连成功后,Address获取Socket指针之前,连接有可能出错,导致Socket被回收,健康检查无法被使能。所以,将持有健康检查引用提前到Create中,并将健康检查引用持有和释放的逻辑封装到函数中,方便使用。

@wwbmmm
Copy link
Contributor

wwbmmm commented Apr 1, 2024

@chenBright 和主干冲突了

@chenBright
Copy link
Contributor Author

@chenBright 和主干冲突了

@wwbmmm done

@wwbmmm
Copy link
Contributor

wwbmmm commented Apr 2, 2024

LGTM

@chenBright chenBright force-pushed the connect_on_create branch 2 times, most recently from 82ae010 to 103e5f0 Compare April 28, 2024 14:23
@chenBright
Copy link
Contributor Author

解决与master的冲突

@wwbmmm
Copy link
Contributor

wwbmmm commented Jun 3, 2024

@chenBright 又冲突了。。

@chenBright
Copy link
Contributor Author

@wwbmmm done,rebase解决冲突。

@wwbmmm wwbmmm merged commit 15469ed into apache:master Jun 13, 2024
20 checks passed
@chenBright chenBright deleted the connect_on_create branch June 13, 2024 06:13
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