brpc icon indicating copy to clipboard operation
brpc copied to clipboard

Support connect on socket create

Open chenBright opened this issue 1 year ago • 1 comments

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.(请遵循贡献者准则).

chenBright avatar Mar 17 '24 16:03 chenBright

LGTM

wwbmmm avatar Mar 21 '24 05:03 wwbmmm

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

chenBright avatar Mar 26 '24 15:03 chenBright

@chenBright 和主干冲突了

wwbmmm avatar Apr 01 '24 02:04 wwbmmm

@chenBright 和主干冲突了

@wwbmmm done

chenBright avatar Apr 01 '24 12:04 chenBright

LGTM

wwbmmm avatar Apr 02 '24 03:04 wwbmmm

解决与master的冲突

chenBright avatar Apr 28 '24 14:04 chenBright

@chenBright 又冲突了。。

wwbmmm avatar Jun 03 '24 08:06 wwbmmm

@wwbmmm done,rebase解决冲突。

chenBright avatar Jun 11 '24 06:06 chenBright