zyearn commented on code in PR #1817:
URL: https://github.com/apache/incubator-brpc/pull/1817#discussion_r928310611
##########
src/brpc/socket.h:
##########
@@ -797,9 +805,17 @@ friend void DereferenceSocket(Socket*);
// Set by SetLogOff
butil::atomic<bool> _logoff_flag;
- // Flag used to mark whether additional reference has been decreased
- // by either `SetFailed' or `SetRecycle'
- butil::atomic<bool> _recycle_flag;
+ enum AdditionalRefStatus {
+ REF_USING, // socket is normal
+ REF_REVIVING, // socket is reviving
+ REF_RECYCLED // socket has been recycled
+ };
+
+ // additional ref status:
+ // Socket()、Create(): REF_USING
+ // SetFailed(): REF_USING -> REF_RECYCLED
+ // Revive(): REF_RECYCLED -> REF_REVIVING -> REF_USING
Review Comment:
这里能在注释里简单描述下需要这三个状态的理由吗
##########
src/brpc/socket.h:
##########
@@ -797,9 +805,17 @@ friend void DereferenceSocket(Socket*);
// Set by SetLogOff
butil::atomic<bool> _logoff_flag;
- // Flag used to mark whether additional reference has been decreased
- // by either `SetFailed' or `SetRecycle'
- butil::atomic<bool> _recycle_flag;
+ enum AdditionalRefStatus {
+ REF_USING, // socket is normal
+ REF_REVIVING, // socket is reviving
+ REF_RECYCLED // socket has been recycled
Review Comment:
在brpc里socket recycle的意思是归还到resource pool里,注释写的是“socket has been
recycled”,用原来的注释可能更清楚一些。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]