-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: init every class member's value to defeat the redis-cli connection closed by pika #1390
Changes from all commits
bb610d6
2b0156f
2fd19da
068a065
74cea6b
1bdfa3a
66aa748
436647e
1b0a2a5
c238b83
78530bd
9260f49
6168cad
298fb14
69be164
840090f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,13 +20,16 @@ class NetItem { | |
|
||
int fd() const { return fd_; } | ||
std::string ip_port() const { return ip_port_; } | ||
std::string String() const { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ToString There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
我这个是借鉴 Go 的实现,ToString() 是 Java 的吗? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 额接口名字而已,String也行,别的库基本都是ToString ToStringView to_string to_stringview 这几类 |
||
return std::to_string(fd_) + ":" + ip_port_ + ":" + std::to_string(notify_type_); | ||
} | ||
|
||
NotifyType notify_type() const { return notify_type_; } | ||
|
||
private: | ||
int fd_; | ||
int fd_ = -1; | ||
std::string ip_port_; | ||
NotifyType notify_type_; | ||
NotifyType notify_type_ = kNotiConnect; | ||
}; | ||
|
||
} // namespace net | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ToString